joy_shukla
Junior Member level 2
please help me .. i try to display address and command on lcd but it shows grabage value , sometimes address-0,command-0, address-31,command-63 like that .. please see the code & advice me what to do ??
$regfile = "8052.dat"
$crystal = 12000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = P1.2 , Db5 = P1.3 , Db6 = P1.4 , Db7 = P1.5 , E = P1.1 , Rs = P1.0
Dim New As Bit
Dim Command As Byte , Subaddress As Byte , Tempadd As Bit
Reset Tcon.0 'triggered by rising edge
On Int0 Receiverc5
Enable Int0
Enable Interrupts
Do
If New = 1 Then 'received new code
Disable Int0
Cls
Lcd "Address : " ; Subaddress
Lowerline
Lcd "Command : " ; Command
Wait 1
New = 0 'reset new bit
Enable Int0
End If
Loop
Receiverc5: 'interrupt routine
'the getrc5 routine uses 30 bytes ! of the stack for measuring
'the interval between the bits
Getrc5(subaddress , Command)
If Subaddress.5 = Tempadd Then
New = 1
Tempadd = Subaddress.5
cpl tempadd
End If
Subaddress = Subaddress And &B00011111 'set flag
Return
$regfile = "8052.dat"
$crystal = 12000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = P1.2 , Db5 = P1.3 , Db6 = P1.4 , Db7 = P1.5 , E = P1.1 , Rs = P1.0
Dim New As Bit
Dim Command As Byte , Subaddress As Byte , Tempadd As Bit
Reset Tcon.0 'triggered by rising edge
On Int0 Receiverc5
Enable Int0
Enable Interrupts
Do
If New = 1 Then 'received new code
Disable Int0
Cls
Lcd "Address : " ; Subaddress
Lowerline
Lcd "Command : " ; Command
Wait 1
New = 0 'reset new bit
Enable Int0
End If
Loop
Receiverc5: 'interrupt routine
'the getrc5 routine uses 30 bytes ! of the stack for measuring
'the interval between the bits
Getrc5(subaddress , Command)
If Subaddress.5 = Tempadd Then
New = 1
Tempadd = Subaddress.5
cpl tempadd
End If
Subaddress = Subaddress And &B00011111 'set flag
Return