Thanks for the reply.
I already test the holtek IC using direct connection but the result is still the same.No noise but The Rx cannot receive the data and my LCD just show static word "BUS15". Maybe there is something wrong with the code.I post the code below.Can you check it for me??
Tx part
'
' TX code
' =======
'
@ device HS_OSC, LVP_OFF
define OSC 20
DEFINE LCD_DREG PORTC 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTB 'LCD register select port
DEFINE LCD_RSBIT 7 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 5 'LCD enable bit
DEFINE LCD_RWREG PORTB 'LCD read/write port
DEFINE LCD_RWBIT 6 'LCD read/write bit
DEFINE LCD_BITS 8;4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
TransmitterPIN VAR PORTA.0
DEFINE CHAR_PACING 500
TRISA = 0 'Set port A as output
TRISB = 0 'Set port B as output
TRISC = 0 'Set port C as output
TRISD = 0 'Set port D as output
' Define program variables
INCLUDE "modedefs.bas"
col var byte ' Keypad column
row var byte ' Keypad row
key var byte ' Key value
Synk VAR BYTE
Synk = $55
ADCON1 = 7 ' Make PORTA and PORTE digital
low PORTB.6 'Set the R/W bit to low
High TransmitterPin
Pause 500 ' Wait for LCD to start
Lcdout $fe, 1, "Key In Bus ID" ' Display sign on message
loop:
Gosub getkey ' Get a key from the keypad
Lcdout $FE, $C0, "BUS",DEC2 key ' Display ASCII key number
PORTA=KEY
Goto loop ' Do it forever
' Subroutine to get a key from keypad
getkey:
PORTD = 0 ' All output pins low
TRISD = $f0 ' Bottom 4 pins out, top 4 pins in
WHILE PORTD != $F0 : wEND ' Wait 'till all key=up
PAUSE 50 ' Debounce
ScanKeypad:
For col = 0 to 3 '
TRISD=~(DCD COL) ' Set one I/O to output
PAUSEUS 5 ' wait a little bit to avoid
' erratic results
'
ROW=ncd((~(PORTD>>4)) & $f) ' read row
'
IF ROW THEN ' Any key pressed?
key = ((row-1)*4)+ col+1' --- YES convert key value
return ' and getout of here
ENDIF '
NEXT '
Goto ScanKeypad ' No keys down, go look again
Rx Part
'
' RX code
' =======
'
@ device HS_OSC, LVP_OFF
define OSC 20
DEFINE LCD_DREG PORTC 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTB 'LCD register select port
DEFINE LCD_RSBIT 7 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 5 'LCD enable bit
DEFINE LCD_RWREG PORTB 'LCD read/write port
DEFINE LCD_RWBIT 6 'LCD read/write bit
DEFINE LCD_BITS 8 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
TRISA = 255 ' PORTA as input
TRISB = 0 ' Set port B as output
TRISC = 0 ' Set port C as output
TRISD = 0 ' Set port D as output
ReciverPIN VAR PORTA.0
ADCON1 = 7 ' Alla digitala
INCLUDE "modedefs.bas"
YourByteVar var byte
low PORTB.6 'Set the R/W bit to low
pause 500 'wait until the LCD initializes
LCDOUT $FE,1, "Receiving Bus ID"
Main:
YourByteVar=PORTA & $0F
Lcdout $FE,$C0,"BUS", DEC2 YourByteVar
GOTO Main
Bookmarks