To exclude the PIC I changed to a 18F4455 because this one i have in stock:
When programming the following code:
Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 20-10-2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Include "modedefs.bas"
Define OSC 20
DEFINE DEBUG_REG PORTB
DEFINE DEBUG_BIT 6
DEFINE DEBUG_BAUD 9600
DEFINE DEBUG_MODE 1
DEFINE LCD_DREG PORTB
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 6
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 7
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
StatusLED VAR PORTB.7 ' Status LEDs
RS232_In VAR PORTB.5 ' RS232 From DIGI-ME Module
DigiData VAR BYTE[74] ' Array for rrecieved RS232 Data
nt_1 VAR BYTE[74]
Aantal_Berichten VAR BYTE ' Aantal aanwezige berichten
Data_available VAR BIT ' Nieuw bericht aanwezig
Update_Debug VAR BIT ' ververs de debug data
Button_Temp1 VAR BIT
Button_Temp2 VAR BIT
x var byte ' Algemeen te gebruiken teller
i VAR Byte ' Teller binnenkomende karakters
Button1 VAR PORTC.0
Button2 VAR PORTC.1
Show_Bericht VAR BYTE
TRISD = 0
PORTD = 0
PAUSE 500 ' Opstart pauze
Init:
Aantal_Berichten = 0
Data_available = 0
Update_Debug = 0
x = 0
i = 0
debug "Startup Alarm systeem V1.01",13,10
Lcdout $FE, $01, "Rekavo"
Lcdout $FE, $C0, "Bericht systeem"
PAUSE 500
FOR x = 0 to 4
High Statusled
PAUSE 50
LOW Statusled
PAUSE 50
NEXT x
Goto Main
Main:
If Update_Debug = 1 Then
Debug "Aantal berichten in geheugen: ", DEC2 Aantal_Berichten,13,10
Debug "Ontvangen bericht: ", DEC2 Aantal_Berichten,13,10
For i = 0 to 74
DEBUG DigiData[i]
NEXT i
DEBUG 13,10,13,10
Update_Debug = 0
ENDIF
GOSUB Check_RS232
Goto Main
'===============================================================================
' Check RS232 Port for data
'===============================================================================
Check_RS232:
SERIN RS232_In,N9600,10,Main,DigiData[0]
for i = 1 to 74
SERIN RS232_In,N9600,1,Main,DigiData[i]
next i
IF (DigiData[0] = $02) AND (DigiData[74] = $03) Then
Debug "Juiste string ontvangen",13,10
Data_available = 1
Aantal_Berichten = Aantal_Berichten + 1
Update_Debug = 1
' Zet het ontvangen bericht in de juiste vrije plaats
'GOSUB Plaats_In_Geheugen
ELSE
Debug "Onjuiste string ontvangen",13,10
endif
Return
END
The microprocessor starts up sends the INIT text 2 times and hangs.
In the attachment you find the configuration settings.
Bookmarks