Menu

Serial Comms with 16f648a

Help
2007-01-29
2013-05-30
  • Nobody/Anonymous

    Been trying out the serial commands as per other posts.  Need to send output to a serial lcd that requires 9600 baud, no parity, and ttl input.  Per previous post, have adjusted the r9600 value from 9 to 13-40/mhz with no conclusive results other than invalid charactor(s) showing up.  Any ideas?  The code:

    'Serial LCD routine
    #chip 16F648A,20
    #mem 256
    #config  _CP_OFF & _DATA_CP_OFF  &_WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _LVP_OFF

    #define SendAHigh SET PORTB.7 ON 
    #define SendALow SET PORTB.7 OFF
    #define Led PortB.3
    dir PortB.7 Out
    dir PortB.3 Out
    dim hello as string
    InitSer (1, r9600, 1+WAITForStart, 8, 1, none, normal)

    Main:
    Set Led On
    wait 1 s
    hello$ = "hello"
    SerPrint(1,hello$)
    wait 1 s
    temp = 99
    SerSend(1, temp)
    wait 1 s
    Set Led Off
    wait 1 s
    goto Main

     
    • Nobody/Anonymous

      Thanks to Steve for posting hardware Usart code.  Can now transmit strings @9600 baud to the serial LCD.

      Kent

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.