--=-RCkAXv/rj4XNYAqQr2lV Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I have the following program that is supposed to, at reset, send the character "A" at 9600 bit/sec on the PB7 pin. I do not get anything back :( Any ideas ? Amaury ;; program to send 'A' on the serial port ;;=20 list f=3DINHX8M, p=3D16F84 __config 0x1ff9 ;; status register status equ 0x07 ; status register rp0 equ 5 ; carry equ 0 ; the carry bit ;; port B configuration portb equ 0x06 ; I/O port B serio equ 7 ; the serial i/o is RB7 sda equ 5 ; SDA is RB5 scl equ 4 ; SCL is RB4 trisb equ 0x86 ; trisb is the direction register for port B ;; serial bus buffers/counters sobuf equ 0x0c ; serial output buffer sibuf equ 0x0d ; serial input buffer sctr equ 0x0e ; counter for bits to output to serial port delay equ 0x0f ; wait counter for serial i/o ;; beginning of the program ;; jump over the interrupt vector org 0 init goto start ;; interrupt vector ;; do nothing org 4 intr retfie ; do nothing if an interuption occurs =09 start bcf status, rp0 ; select bank 0 clrf portb ; clears port B=09 bsf status, rp0 ; select bank 1 movlw 0x00 ; all pins in output position movwf trisb ; sets direction for all pins to "output" movlw 'A' ; character 'A' movwf sobuf ; stores the character in the buffer call ssbyte ; sends a byte sleep ; stops the program =09 ;; sends a byte ;; gets the byte in the W register ;; output pin is RB7 ;; first, send the start bit ssbyte btfsc portb, serio ; tests if the serial i/o was up goto stbit ; no, create a stop bit bsf portb, serio ; sets portb so that we have a stop bit call swbit ; waits for the lenght of a bit stbit movlw 8 ; 8 bits to send movwf sctr ; move to counter register bcf portb, serio call swbit ;; first, shift the buffer through the carry sbitlp rrf sobuf, 1 ; btfsc status, carry ; test the carry goto sbset ; the bit is set ;; the bit is clear bcf portb, serio ; clear the bit goto sbwait ; go to the wait call ;; the bit is set sbset nop ; cycle bsf portb, serio ; set the bit sbwait call swbit ; wait ;; decrement the counter decfsz sctr, 1 ; one bit done ! goto sbitlp ; no, still some bits ;; TODO : now, insert parity ;; stop bit bsf portb, serio ; stop bits are up call swbit ; wait to the end of the bit return ; do nothing at the moment ;; wait for 104 cycles (1 bit) ;; 7 cycles used swbit movlw 0x2E ; load counter movwf delay ; ;; 9 cycles used. 95 remaining swblp decfsz delay, 1 ; decrement counter +1 goto swblp ; loop +1=09 return ; this is supposed to wait for 1/9600 of a second end --=-RCkAXv/rj4XNYAqQr2lV Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQA7gBnAOxdCu1w6Y38RAtBrAJ9mt0ertCggHu9j2KfhbXPHtRgiaQCgsXdt H9oDJnyxPn6WxxFeaCogmqo= =bCR1 -----END PGP SIGNATURE----- --=-RCkAXv/rj4XNYAqQr2lV-- -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu