Hi-
I cannot find what I am missing. I cannot control Port B.4, it acts as an input and interrupts the program flow. I have code below that shows the problem:
' Device Settings
@ DEVICE PIC16F628 ' PIC Device
@ DEVICE EC_OSC ' External Oscillator
@ DEVICE LVP_OFF ' Low-Voltage Programming
@ DEVICE WDT_OFF ' Watchdog Timer
@ DEVICE PWRT_ON ' Power-On Reset
@ DEVICE MCLR_OFF ' Master Clear
@ DEVICE BOD_OFF ' Brown-Out Detect
@ DEVICE CPD_OFF ' Data Memory Code Protection
@ DEVICE PROTECT_OFF ' Program Code Protection
' Set Environment Variables
DEFINE OSC 20 ' Oscillator speed, 20MHz
TRISA = %00000000 ' Port A All Outputs
TRISB = %00000000 ' Port B All Outputs
' Main Program
PortB = $FF ' Port B All Set High
PortB.4 = 1 ' B4 Set High
While (1)
toggle PortA.0 ' Heartbeat
pause 250
WEND
END
When I run this, all port B goes high except B.4. I have tried to use a pull-up, in case it is open collector, but that stops the heartbeat. I have tried several different 628s, and they all act the same. I figure it must be a fuse set wrong, but I don't know what.
Any help would be gratefully accepted!
Bookmarks