Communication between two PicChip


Results 1 to 29 of 29

Threaded View

  1. #15
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Communication between two PicChip

    STILL NOT TRANSMITTING. as least I am getting any compilation errors..: here is my transmitter code:

    (I just see these before word on my LCD)

    Code:
    INCLUDE "modedefs.bas"
     OSCCON = 110000 '8 Mhz
     Define OSC 8 
     
        ' Set transmit register to transmitter enabled
        DEFINE HSER_TXSTA    20h
    
        ' Set baud rate
        DEFINE HSER_BAUD    2400
    
        ' Set SPBRG directly (normally set by HSER_BAUD)
        DEFINE HSER_SPBRG    25
        
    CMCON = 7 : ANSEL = 0 : ADCON1 = 7
    '/////////////////////////
    '// LCD configuration //
    '/////////////////////////
    
    DEFINE LCD_DREG PORTA ' Set LCD Data port
    DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
    DEFINE LCD_RSBIT 0 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB ' Set LCD Enable port
    DEFINE LCD_EBIT 6 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000
    pause 500
    
    cou var byte
    temp1 var byte
    temp2 var byte
    
    Mainloop:
    
      temp1 =18: temp2 =22
      cou =44 
    
    
    lcdout $FE,1, "TempC: ", dec (temp1) , ".", dec2 temp2," ",$DF,"C"
    lcdout $FE,$C0, bin cou , ".","F"
    pause 400
    
    Hserout [DEC temp1]
    PAUSE 50
    
    lcdout $FE,1 : LCDOUT "second  ", dec (temp2 / 100) , ".", dec2 temp1," ",$DF,"r"
    lcdout $FE,$C0, dec cou , ".","23"
    pause 400
    
    goto mainloop
    
    end
    and my receiver code
    Code:
    INCLUDE "modedefs.bas"
     OSCCON = 110000 '8 Mhz
     Define OSC 8 
     
         ' Set receive register to receiver enabled
        DEFINE HSER_RCSTA    90h
    
        ' Set baud rate
        DEFINE HSER_BAUD    2400
    
        ' Set SPBRG directly (normally set by HSER_BAUD)
        DEFINE HSER_SPBRG    25
        
        
    CMCON = 7 : ANSEL = 0 : ADCON1 = 7
    '/////////////////////////
    '// LCD configuration //
    '/////////////////////////
    
    DEFINE LCD_DREG PORTA ' Set LCD Data port
    DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
    DEFINE LCD_RSBIT 0 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB ' Set LCD Enable port
    DEFINE LCD_EBIT 6 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000
    pause 500
    
     encoded22 var word 
    
    
    Mainloop:
    
    
    lcdout $FE,1 , "hello  "
    lcdout $FE,$C0, "before"
    pause 300
    
    Hserin [DEC encoded22]
    PAUSE 100
    
    lcdout $FE,1, "after"    
    lcdout $FE,$C0, "AFTER: ", "-", dec encoded22 , "After"
    Pause 300
    
    
    goto Mainloop
    
    end
    Last edited by lerameur; - 15th November 2011 at 02:43.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts