B register partial Schmidt input, partial CMOS inputs
I am implementing a line follower with the SX28 using SXB.
I need to have Rb.2 to have a CMOS input, Rb.3 to be an output, and all the other B register pins to be schmidt trigger inputs.
I have figured out how to do Rb.2 & Rb.3, but how to make the others schmidt triggers without bothering the first two?
I have tried using LVL_B, but can't get the compiler to recognize it.· My help says that the Schmitt command only works with SX48 & 52.
I am not a assy code programmer, so help!
I need to have Rb.2 to have a CMOS input, Rb.3 to be an output, and all the other B register pins to be schmidt trigger inputs.
I have figured out how to do Rb.2 & Rb.3, but how to make the others schmidt triggers without bothering the first two?
I have tried using LVL_B, but can't get the compiler to recognize it.· My help says that the Schmitt command only works with SX48 & 52.
I am not a assy code programmer, so help!
Comments
Double check, please... it's been a long day.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never argue with an idiot.· They'll drag you down to their level then beat you with experience.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
Thanks JohnnyMac & Bean
Where do I put these statements? In the PIN definitions or in the Initialization code?
Do they have to be in the order shown?
I have the A/D working now, but one of the inputs that was working earlier is not now. It is one of the schmitt trigger inputs, Rb.1.· It is changing in the registers as viewed in debug, but not in the "watch" list.· What gives?· I even eliminated all the special code to look at the sensor input only.(see code below), and it still doesn't change in the "watch" list.
My line follower has 3 ir sensors.
Left Sensor is Rb.0
Center sensor is on a/d Rb.2
Center sensor output for a/d Rb.3
Right Sensor is Rb.1
I have the following in the Pin descriptions:
InPin PIN Rb.2 INPUT CMOS
OutPin PIN Rb.3 OUTPUT
lft_lnsnsr PIN RB.0 INPUT SCHMITT 'Set B to schmitt inputs
rt_lnsnsr PIN RB.1 INPUT SCHMITT 'Set B to schmitt inputs
last code to test sensor inputs:
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
ID············· "SXB 7807"
'
' IO Pins
'
································ '
Direction Truth Table
lft_lnsnsr·var·rb.0
ctr_lnsnsr·var·rb.2
rt_lnsnsr·var·rb.1
'
' Constants
'
'
' Variables
'
Watch lft_lnsnsr
Watch ctr_lnsnsr
Watch rt_lnsnsr
'
· 'INTERRUPT
'
'ISR_Start:
· ' ISR code here
·'ANALOGIN InPin, OutPin, adcval, 2
'ISR_Exit:
· 'RETURNINT ' {cycles}································
'
' Subroutine Declarations
'
'
·Program Start
'
Start:
· TRIS_C = %0000000··'Set C to outputs
· ST_B =%11111111··'Set B to schmitt inputs
·
· 'LOW Enable_Right·············· 'Turn off Right Motor
· 'LOW Enable_Left··············· 'Turn off Left Motor
· 'Pause 5000
MAIN:
·· input ctr_lnsnsr
·· input rt_lnsnsr
·· input lft_lnsnsr
·
· goto main
I have had some trouble trying to WATCH single bits through Debug in the past. The following threads contain relevant information about when this problem has been observed.
WTCHing a pin with SX/B (Without using a variable)
Watched Bit not Showing Changes
- Sparks