hi...anyone can help me to convert this to C since i only have ccs compiler to compile the program instead of the PICbasic compiler..
'Serial A/D converter and toxic gas program
Low 1 'Bring I/o to clock low
stat:
Gosub serial_in
'LCD routine
Serout 3, N2400, (254,1)
Pause 1
Serout3, N2400, (#b0)
Pause 100 'Let me see the display
if b0 > 190 Then fan1 'Turn fan on
If b0 < 191 Then fan2 'Turn fan off
Goto start
'Serial in routine
serial_in:
Low 2 'Bring CS down low
bit7 = pin 0 'Load bit 7 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit6 = pin0 'Load bit 6 into B0
Pulaout 1,1 'Bring CLK pin high, then low
bit5 = pin0 'Load bit 5 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit4 = pin0 'Load bit 4 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit3 = pin0 'Load bit 3 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit2 = pin0 'Load bit 2 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit1 = pin0 'Load bit 1 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit0 = pin0 'Load bit 0 into B0
Pulsout 1,1
High 2 'Bring CS high
Return
fan1:
High 4
Goto start
fan2:
Low 4
Goto start
'Serial A/D converter and toxic gas program
Low 1 'Bring I/o to clock low
stat:
Gosub serial_in
'LCD routine
Serout 3, N2400, (254,1)
Pause 1
Serout3, N2400, (#b0)
Pause 100 'Let me see the display
if b0 > 190 Then fan1 'Turn fan on
If b0 < 191 Then fan2 'Turn fan off
Goto start
'Serial in routine
serial_in:
Low 2 'Bring CS down low
bit7 = pin 0 'Load bit 7 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit6 = pin0 'Load bit 6 into B0
Pulaout 1,1 'Bring CLK pin high, then low
bit5 = pin0 'Load bit 5 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit4 = pin0 'Load bit 4 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit3 = pin0 'Load bit 3 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit2 = pin0 'Load bit 2 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit1 = pin0 'Load bit 1 into B0
Pulsout 1,1 'Bring CLK pin high, then low
bit0 = pin0 'Load bit 0 into B0
Pulsout 1,1
High 2 'Bring CS high
Return
fan1:
High 4
Goto start
fan2:
Low 4
Goto start