Patrik Husfloen wrote: > > I don't generally approve of questions like "what's wrong with this" accompanied by lines of source. > But right now I'm stumped, I wrote an rs232 routine that sends data at 9600bps, it did infact send data, not the character I told it to though, so I re-wrote parts of it where I found errors in the code. > and now it's not sending anything, if I had access to a scope I'm sure I could find it but I've looked at this code for the past 40 mins, I've ran it through mplab sim a few times and it seems to run great. > I know it's not pretty, I just whipped it up verify the circuit was connected properly. > the d_104 is a 104usec delay, the timing is off by a few percent but even still I should get something in the hyperterminal, the data is sent 8 databits, no parity, and 2 stopbits. I don't have time to test your code, but this may help verify your circuit. I just snapped this out of ROMzap. It should work at 9600 baud. The code is isosyncronous at 104uS with 4MHz crystal. ; ; ---------------- ; TRANSMIT ROUTINE ; ---------------- ; TxRoutine movwf TxSend ; temp store data to be sent bcf PORTB,4 ; do start bit call HBDelay5 call HBDelay2 ; movlw 8h ; 8 data bits to send movwf BCount ; TxLoop rrf TxSend,F btfsc STATUS,C goto TxHiBit ; nop bcf PORTB,4 goto DoneBit ; TxHiBit bsf PORTB,4 goto $ + 1 ; DoneBit call HBDelay5 ; wait 1 bit length call HBDelay5 decfsz BCount,F goto TxLoop ; call DoRet nop bsf PORTB,4 ; stop bit call HBDelay1 call HBDelay DoRet return ; ; ----------------------------------- ; HALF BIT DELAY FOR 9600 BAUD @ 4MHz ; ----------------------------------- ; HBDelay nop HBDelay1 nop HBDelay2 goto $ + 1 HBDelay4 nop HBDelay5 movlw 0x0D movwf BitWait BW decfsz BitWait,F goto BW CLRWDT nop nop return -- Best regards Tony mICros http://www.bubblesoftonline.com mailto:sales@bubblesoftonline.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads