PDA

View Full Version : 16F628 does not run. I can't believe this



Ioannis
- 3rd October 2009, 15:17
I have been trying all day to run this program on a 16F628 and the damn thing does not.

I can't believe that I cannot make it run. Oh God I am gonna smash it.

I'll give it a chance.

Please if anyone can see what I am missing, please help.

Chip is 16F628 with ceramic resonator. Checked the freq and is close to 4MHz. Also the Option_Reg seems to be configured OK because of the Pull ups checked on port B, but then, nothing happens...



DEFINE OSC 4
INCLUDE "C:\PBP\MODEDEFS.BAS"

;----- Configuration bits ------------------------------------------------

@Line1 = _LVP_OFF & _BODEN_ON & _DATA_CP_ON
@Line2 = _CP_ALL & _MCLRE_ON & _PWRTE_ON & _WDT_ON & _XT_OSC

@ __CONFIG Line1 & Line2

cmcon=7 'disable portA comparators
intcon=0 'disable interrupts
vrcon=0 'disable reference voltage output at porta.2

TRISA = %00000000 'PA0:
'PA1:
'PA2:
'PA3:Relay
'PA4:Buzzer
'PA5:

TRISB = %01110010 'PB0:
'PB1:Serial Input
'PB2:Serial Output
'PB3:RS485 Direction
'PB4:D0
'PB5:D1
'PB6:Button
'PB7:

option_reg=%00000000

relay var porta.3
buzzer var porta.4

dir var portb.3
d0 var portb.4 'Wiegand D0 input
d1 var portb.5 'Wiegand D1 input
but var portb.6 'Button input

data_array var byte[3] 'Wiegand data array
byte_1 var data_array[2]
byte_2 var data_array[1]
byte_3 var data_array[0]

clear
high buzzer:pause 500:low buzzer

stop

end


Ioannis

Ioannis
- 3rd October 2009, 15:41
OK. I found it. How silly I was. RA4 is output but also Open Drain...

Ioannis