cluster
- 6th November 2011, 03:58
Hello
below is my code. i am using pic18f4550. light start to blink as expected but when anything is sent serially it hangs pic and blinking light stops.
DEFINE RESET_ORG 0x1000
DEFINE OSC 48
adcon1 = 15
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 9600
SerialData var byte
RXIF VAR PIR1.5
TXIF VAR PIR1.4
DEFINE USE_LOWPRIORITY 1
;--- Setup Interrupts ------------------------------------------------------
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
include "ReEnterPBP-18.bas"
include "ReEnterPBP-18LP.bas"
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler USB_Handler
endm
INT_CREATE ; Creates the interrupt processor
INT_LIST_L macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX_INT, _Receive, PBP, no
endm
INT_CREATE_L
endasm
@ INT_ENABLE RX_INT
;--- Setup USB -------------------------------------------------------------
INCLUDE "DT_HID260.pbp"
DEFINE USB_VENDORID 6017
DEFINE USB_PRODUCTID 2000
DEFINE USB_VERSION 1
DEFINE USB_VENDORNAME "Test"
DEFINE USB_PRODUCTNAME "Test"
DEFINE USB_SERIAL "001"
DEFINE USB_INSIZE 64;32 ; IN report is PIC to PC (8,16,32,64)
DEFINE USB_OUTSIZE 64;16 ; OUT report is PC to PIC
DEFINE USB_POLLIN 10 ; Polling times in mS, MIN=1 MAX=10
DEFINE USB_POLLOUT 10
; --- Each USB LED is optional, comment them if not used ----
DEFINE USB_LEDPOLARITY 1 ; LED ON State [0 or 1] (default = 1)
DEFINE USB_PLUGGEDLED PORTB,0 ; LED indicates if USB is connected
DEFINE USB_TXLED PORTC,2 ; " " data being sent to PC
DEFINE USB_RXLED PORTC,1 ; " " data being received from PC
main:
Toggle porta.0
pause 50
goto main
Receive:
HSERIN [Serialdata]
hserout [Serialdata,13,10]
back:
@ INT_RETURN
any suggestions appreciated.
thank you
below is my code. i am using pic18f4550. light start to blink as expected but when anything is sent serially it hangs pic and blinking light stops.
DEFINE RESET_ORG 0x1000
DEFINE OSC 48
adcon1 = 15
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 9600
SerialData var byte
RXIF VAR PIR1.5
TXIF VAR PIR1.4
DEFINE USE_LOWPRIORITY 1
;--- Setup Interrupts ------------------------------------------------------
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
include "ReEnterPBP-18.bas"
include "ReEnterPBP-18LP.bas"
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler USB_Handler
endm
INT_CREATE ; Creates the interrupt processor
INT_LIST_L macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX_INT, _Receive, PBP, no
endm
INT_CREATE_L
endasm
@ INT_ENABLE RX_INT
;--- Setup USB -------------------------------------------------------------
INCLUDE "DT_HID260.pbp"
DEFINE USB_VENDORID 6017
DEFINE USB_PRODUCTID 2000
DEFINE USB_VERSION 1
DEFINE USB_VENDORNAME "Test"
DEFINE USB_PRODUCTNAME "Test"
DEFINE USB_SERIAL "001"
DEFINE USB_INSIZE 64;32 ; IN report is PIC to PC (8,16,32,64)
DEFINE USB_OUTSIZE 64;16 ; OUT report is PC to PIC
DEFINE USB_POLLIN 10 ; Polling times in mS, MIN=1 MAX=10
DEFINE USB_POLLOUT 10
; --- Each USB LED is optional, comment them if not used ----
DEFINE USB_LEDPOLARITY 1 ; LED ON State [0 or 1] (default = 1)
DEFINE USB_PLUGGEDLED PORTB,0 ; LED indicates if USB is connected
DEFINE USB_TXLED PORTC,2 ; " " data being sent to PC
DEFINE USB_RXLED PORTC,1 ; " " data being received from PC
main:
Toggle porta.0
pause 50
goto main
Receive:
HSERIN [Serialdata]
hserout [Serialdata,13,10]
back:
@ INT_RETURN
any suggestions appreciated.
thank you