Do PIC's allow letters as literals? What value does it use for them Ascii standard? -----Original Message----- From: Michael Rigby-Jones [mailto:mrjones@NORTELNETWORKS.COM] Sent: Friday, December 08, 2000 9:04 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: Newbie PICster > -----Original Message----- > From: Duane Brantley [SMTP:Duane.Brantley@GENBAND.COM] > Sent: Friday, December 08, 2000 1:09 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Newbie PICster > > Hello all, > > This is my first attempt at using a PIC. I thought I'd start out simple > and > grow from there. I tried writing a small program in MPASM to send the > word > "Hello" out the USART on a F877, but with no luck. I was wondering if > someone could take a look at it, and tell me what I'm doing wrong. > > Cheers, > Duane > > > ;========(HELLO.ASM)====================================================== > == > =======(12/4/00)===== > ;This program will display the text "Hello" on the LCD. > ;------------------------------------------------------------------------- > -- > --------------------- > list p=16f877 > #include > radix hex > ;------------------------------------------------------------------------- > -- > --------------------- > ; cpu equates (memory map) > ;-------MAIN-------------------------------------------------------------- > -- > --------------------- > > org 0x000 > SETBAUD: bcf STATUS,RP1 ; > bSf STATUS,RP0 ; Bank 1 > movlw 0x81 ; Set Baud Rate to 9600 > movwf SPBRG ; > movlw 0x26 ; 8-bit transmit, transmitter > enabled > movwf TXSTA ; > bcf TRISC,6 ; set RC6 as output > bcf PIE1,4 ; clear interrupt bit (TXIE) > bcf STATUS,RP0 ; Bank 0 > movlw 0x80 ; > movwf RCSTA ; Serial port enabled > goto HELLO > > SERIAL: btfss PIR1,4 ; wait for bit 4 = 1 (showing TXREG empty) > goto SERIAL ; <== I get stuck in a loop here > nop > movwf TXREG > return > > HELLO: movlw 'H' ; Send out 'Hello' > movwf TXREG > call SERIAL > movlw 'e' > movwf TXREG > call SERIAL > movlw 'l' > movwf TXREG > call SERIAL > movlw 'l' > movwf TXREG > call SERIAL > movlw 'o' > movwf TXREG > end > > You have to set the SPEN bit (bit 7 of register RCSTA) to enable the serial port. The datasheet also states that bits TRISC6 and TRISC7 have to be set, i.e. configured as inputs. However ISTR there was some quite heated debate a while back on the list as to whether this was actualy required. Regards Mike -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads