📄 irserin.bas
字号:
' Title IRSerin.Bas
' @ L. Johnson 20th September 1999
'
' This Program Compliments the IRSerTst.Bas Program
' A Sharp Infra-Red Sensor should be connected to PORTB.1
' And the Serial LCD should be connected to PORTB.0
'
' Because of the Inverting affect of the IR sensor
' the serial receiver is the opposite mode to the transmitter
' The Transmitter sends at 1200 Baud Inverted Mode
' The Receiver will be set to 1200 Baud True Mode
' This routine is for the 16F84, but any 14bit core PIC could be used
Include "Modedefs.Bas"
' ** Set Xtal Value in Mhz
Define OSC 4 ' Set Xtal Frequency
' ** Set Debug Defines **
Define DEBUG_REG PortB ' Debug PORTB
Define DEBUG_BIT 0 ' *** Debug pin 0 ***
Define DEBUG_BAUD 9600 ' *** Debug Baud Rate ***
Define DEBUG_MODE 0 ' Set Serial Mode 0=True, 1=Inverted
Define DEBUG_PACING 100 ' Delay 'in us' between characters sent
' Declare Variables
SI Var PortB.1 ' Set Serin Pin to PORTB.1
IR_Rcv Var Byte ' Received Value
' Declare Constants
Baud Con T1200 ' Set the Baud rate to match transmitter
' And the Mode, Opposite the transmitter
Pause 400 ' Wait for Pic to Initialize
Debug 254,1:Pause 30 ' Clear the LCD
Main: Serin SI,Baud,IR_Rcv ' Receive the Data from the IR-Sensor
Debug IR_Rcv ' Send the Data to the LCD
Goto Main ' Repeat Forever
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -