I have been learning how to program the Parallax SX28 chip and it seems after 2 weeks I have lost most of my skill at programming Atmel chips.
Anyway I am working on a design where I will use 6 tiny13's to collect data and send that data to the SX chip. The design will have all of the tiny13 PB0 tied together as well ast PB1 and PB2 ports, so 3 buss lines. All pins will be pulled up/input. The SX will pull down PB3 on each chip one at a time, when a chip gets a low signal on its PB3 it flips any or all of PB0,PB1,Pb2 to outputs to pull the SX lines low, the SX chip will read the 3 bits and release the PB3 line.
The code for the tiny13 output is below, it works on the chip but not in the simulator because pinb,3 is never set by the pullup.
Since no pin will be set HIGH and all three of the pins on any chip will only be output LOW I have another question. Should I use resistors or diodes on any of the pins connecting the SX chip?
; ========================= Initialize variables ======================= ldi data, 0b00000111 ldi zero,0x00 ;========================== Set data direction bits ==================== ldi Temp,0b00000000 ;1=output 0 = input out DDRB,Temp ldi temp, 0b00001000 ;1=pullup if input high if output out portb, temp ; ========================= Setup interrupts =========================== ; ========================== Main Program ============================= Mainloop: sbis pinb,3 ;Skip Next line if port is still high rjmp senddata ;If Low send data rjmp Mainloop ;otherwise loop senddata: out DDRB,data ;Put data on pins 2..0 (pulls other uc pins LOW if bit = 1) sending: sbis pinb,3 ;Skip next line if port is high rjmp sending ;If held low just wait out DDRB, zero ;Reset pins to input rjmp mainloop ;Go back to main loop