PDA

View Full Version : Problems programming



Lionheart
- 6th December 2008, 11:38
I have problems programming my PIC12CE674.
I have managed to program my PIC one time, and the program works so the hardware is correct i think.
But afterwards i always ends with a error.

This are my operation options.

L0323: ------------------------------------
L0324: ==== Device operation options ====
L0325: ------------------------------------
L0326: - Insertion test
L0327: Insertion test: Enable
L0328: - Command execution
L0329: Blank check before programming: Disable
L0330: Verify after reading: Enable
L0331: Verify: Twice
L0332: Verify options: VDDnom. +/-10%
L0333: - Programming parameters
L0334: [x] User program memory and ID locations
L0335: [x] Configuration bits
L0336: [x] Oscillator Calibration value
L0337:
L0338: >> 06.12.2008, 12:26:01
L0339: Programming device: Microchip PIC12CE674.
L0340: Buffer checksum in range of [0h..7FFh]: 0008CCF8 - Byte sum (x8)
L0341: Device insertion test ...
L0342: Programming device ...
L0343: Programming device - error!
L0344: ADR=0000h DO=2849h DI=2800h ST=0000
L0345: Elapsed time: 0:00:00.1
L0346: Statistics info: Success:0 Failure:1 Total:1

The config word is:
ID0-ID3 = FFFFh
Oscillator = IntRC osc function GP4
Watchdog = disabled
Power up timer = disabled
Code protect = off
MLRC = connected to vdd

And my program is:
@ device INTRC_OSC ; Internal Oscillator
@ device MCLR_OFF ; Turn OFF Master Clear Reset
@ device WDT_OFF ; Turn OFF WatchDog Timer

'Definitions
DEFINE OSCCAL_2K 1

'Register Initializations'
ADCON1 = 7

GPIO = 0
TRISIO = %111001

'TRISIO.0 = 1 ' define Inputs and Outputs
'TRISIO.1 = 0 ' define Inputs and Outputs
'TRISIO.2 = 0 ' define Inputs and Outputs
'TRISIO.3 = 1 ' define Inputs and Outputs
'TRISIO.4 = 1 ' define Inputs and Outputs
'TRISIO.5 = 1 ' define Inputs and Outputs
'Register Initializations'

'Variabelen
Input_1 VAR GPIO.4
Input_2 VAR GPIO.5
Output_1 VAR GPIO.1
Output_2 VAR GPIO.2
Button_1 var bit
Button_2 var bit
Memory_1 var bit
Memory_2 VAR bit
Max_Pulsen VAR WORD
Pulsen_1 VAR WORD
Pulsen_2 VAR WORD


CLEAR
Max_Pulsen = 50

Main: if input_1 = 1 then
pause 20
button_1 = 1
else
pause 20
button_1 = 0
endif

if input_2 = 1 then
pause 20
button_2 = 1
else
pause 20
button_2 = 0
endif

if (button_1 = 1 & Memory_1 = 0 & pulsen_1 = 0) then
Pulsen_1 = Max_pulsen
Memory_1 = 1
ENDif
If (button_1 = 0 & memory_1 = 1) then
memory_1 = 0
endif
if (button_1 = 1 & memory_1 = 0 & pulsen_1 > 0) then
pulsen_1 = 0
endif

if (button_2 = 1 & Memory_2 = 0 & pulsen_2 = 0) then
Pulsen_2 = Max_pulsen
Memory_2 = 1
ENDif
If (button_2 = 0 & memory_2 = 1) then
memory_2 = 0
endif
if (button_2 = 1 & memory_2 = 0 & pulsen_2 > 0) then
pulsen_2 = 0
endif


if (Pulsen_1 > 0) then
Toggle Output_1
else
output_1 = 0
endif

if (Pulsen_2 > 0) then
Toggle Output_2
else
output_2 = 0
endif

pause 667 '90 periodes per minuut = 0,6ms
goto main
end

I was thinking that the problem was that i didn't give a adress where the program begins. So that the PIC doesn't know where to start my program.

If that is the fault how can i say where he needs to start my program?

Maybe it is somhthing you need to know when i only program the configuration word i have no problems.

I hope that someone knows what i'm doeing wrong.

Thanxs at advance

Lionheart
- 6th December 2008, 12:09
I have found the problem after reading the datasheet throughly, i have found that this kind of pic is a one time programmeble.

Bruce
- 6th December 2008, 13:45
They have a windowed version of this PIC that's erased with a UV light source similar to old EEPROMs, but it's pretty expensive.

If you prefer an 8-pin device, look at some of the newer flash-based parts like the 12Fxxx series. The 12F615 or 12F609 are very inexpensive, and easy to use.

Lionheart
- 7th December 2008, 16:42
It is indeed a good device but i don't see the type in Picbasic Pro, so can i program this device?

I have the chooce between:
12F508
12F509
12F629
12F675
12F683

mackrackit
- 7th December 2008, 16:51
The chips Bruce mentioned are in PBP 2.50.

The chips in your list are good too.