Order Tray | Contact Us | Home | SIG Lists

[picsig] USART Help Requested

Andrew Rich vk4tec at tech-software.net
Thu Jan 6 21:56:21 UTC 2005


I have done this I will help you Steve.

Code coming


  -----Original Message-----
  From: picsig-bounces at lists.tapr.org
[mailto:picsig-bounces at lists.tapr.org]On Behalf Of Steve Bunch
  Sent: Friday, 7 January 2005 7:33 AM
  To: TAPR PIC Mailing List
  Subject: [picsig] USART Help Requested


  Greetings,

  I have recently started programming Microchip's PIC microcontrollers and I
am having difficulty getting the USART on the 16F628A to drive Seetron's
BPI-216 2x16 LCD with the Backpack module. I am a beginner with these
microcontrollers and I done everything I can think of to remedy the problem
but I'm having no luck. The source code listed below is supposed to send the
characters to display "HELLO" and then stop (infinite loop), but instead
produces "ougga" followed by a special character shaped like a little right
leaning triangle that, according to the instructions, is produced by sending
0x00. The PIC then appears to send the special character continuously
overwriting the "ougga". An LED attached to the USART TX pin (RB2) stays lit
indicating continued output. I can reproduce the results upon reset. I get
the same results at 9600 and 2400 baud only faster.
  I've included my source code below based on the example in Sid Katzen's
book "The Quintessential PIC Microcontroller" and any advice would be
greatly appreciated.

  I have periodically been following the discussions on PICSIG email and
recently signed up again. I have not found another microcontroller
discussion group with such great technical expertise aimed at amateur radio
and microcontrollers.

  Thanks, Steve Bunch, (KC0GBK)

  list   p=16f628A
   #include  <p16F628A.inc>
   __config  _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON &
_INTRC_OSC_NOCLKOUT & _MCLRE_ON

   cblock 0x20
      DATA_OUT
   endc

  START
    bsf    STATUS,RP0 ;switch to bank 1
     movlw   b'000000010' ;RB2 is the output
     movwf   TRISB
     movlw   d'25'  ;2400 baud when BRGH=0
     movwf   SPBRG
     movlw   b'00100000' ;asynchronous, 8-bit, enabled
     movwf   TXSTA
     bcf STATUS,RP0 ;back to bank 0
     movlw   b'10010000' ;USART enabled
     movwf   RCSTA

  TEXT
    movlw   d'72'  ;H
     movwf   DATA_OUT
     call   PUTCHAR
     movlw   d'69'  ;E
     movwf   DATA_OUT
     call   PUTCHAR
     movlw   d'76'  ;L
     movwf   DATA_OUT
     call   PUTCHAR
     movlw   d'76'  ;L
     movwf   DATA_OUT
     call   PUTCHAR
     movlw   d'79'  ;O
     movwf   DATA_OUT
     call   PUTCHAR

  DONE
    goto   DONE

  PUTCHAR
    btfss   PIR1,TXIF  ;check, is TX buffer empty?
     goto   PUTCHAR   ;if not, then try again
     movf   DATA_OUT,w  ;else get datum
     movwf   TXREG   ;and copy to USART TX register
     return

     end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.tapr.org/pipermail/picsig/attachments/20050107/916e6ea6/attachment.htm 


More information about the picsig mailing list