chai98a
Joined: 11 Mar 2006 Posts: 2
|
Need somebody help to convert basic code to CCS |
Posted: Sun Mar 19, 2006 4:03 am |
|
|
I have some code with basic need sombody to convert to CCS code
PIC 16F877 , 4 mhz
Code: | :
'DEFINE LOADER_USED 1
DEFINE OSC 4
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 12 ' 19200 Bauds
IR VAR word
pulses VAR byte[33]
BitMask VAR byte
i VAR byte 'loop index
b VAR byte 'byte index
LeadIn VAR word 'start pulse
a1 var byte
a2 var byte
TRISB = %00000001
star:
For i= 0 to 24 ' Do 12-bits
'HSEROUT ["B ",DEC pulses[i],13,10]
NEXT
HSEROUT ["Bottom ",dec ir.lowbyte,13,10]
HSEROUT ["Comand ",dec IR.highbyte,13,10]
a1=ir.lowbyte
a2=ir.highbyte
loop:
'PulsIn GPIO.1, 0, LeadIn
PulsIn Portb.0, 0, LeadIn
If LeadIn < 855 Then loop
If LeadIn > 1045 Then loop
For i = 0 TO 24
'PulsIn GPIO.1, 1, pulses[i]
PulsIn Portb.0, 1, pulses[i]
Next
For i = 17 To 24
If pulses[i] > 99 Then
IR.0=1
else
IR.0=0
endif
ir = ir << 1
Next
Bitmask = ir
goto star |
|
|