LISY 300 Gyroscope
Irvarvlin
Posts: 1
I'm trying to use an18F2525 pic to receive data from an LISY 300 gyroscope, and I'm using PIC basic. But whenever I try to read the data on the HyperTerminal, it just outputs zero. below is the code that I've been using. Can you please help me with this?
DEFINE OSC 4
OSCCON=%01100010
'start:
INCLUDE "modedefs.bas"
'DEFINE ADC_BITS 16
'DEFINE ADC_CLOCK 3
'DEFINE ADC_SAMPLEUS 10
TRISA=%11111111
TRISB=%10000000
TRISC=%10000000
'val var byte
vol var byte
SCLK var PORTC.3
CS var PORTA.0
DOUT var PORTB.0
LOW CS
HIGH SCLK
ADCON1=DOUT
'adcin PORTB.0,vol
loop:
'Serout2 PORTC.6,$40BC,["-Resistance: ",dec res,10,13]
Pause 500
Serout2 PORTC.6,$40BC,["-Out: ",dec DOUT,10,13]
goto loop
'PAUSE 5000
'HIGH PORTA.0
'end
'Goto main
End
DEFINE OSC 4
OSCCON=%01100010
'start:
INCLUDE "modedefs.bas"
'DEFINE ADC_BITS 16
'DEFINE ADC_CLOCK 3
'DEFINE ADC_SAMPLEUS 10
TRISA=%11111111
TRISB=%10000000
TRISC=%10000000
'val var byte
vol var byte
SCLK var PORTC.3
CS var PORTA.0
DOUT var PORTB.0
LOW CS
HIGH SCLK
ADCON1=DOUT
'adcin PORTB.0,vol
loop:
'Serout2 PORTC.6,$40BC,["-Resistance: ",dec res,10,13]
Pause 500
Serout2 PORTC.6,$40BC,["-Out: ",dec DOUT,10,13]
goto loop
'PAUSE 5000
'HIGH PORTA.0
'end
'Goto main
End