PDA

View Full Version : moving from 16F628A to12F629



Camtronics
- 22nd April 2011, 12:25
Hi all,

I am quite new to PIC programming, although somewhere in my education I must have had it. I am working on a project, currently with the PIC16F628A. I have now made new electronics with the 12F629 in it, and having troubles making the right code for it.

Below I have added the top of the old and new code files, without the main program though. What the program does is that it turns on ZEND with some pulses, to trigger and wake up another circuit.

The old working file:

Device 16F628A
Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_OFF
ALL_DIGITAL TRUE

Symbol ZEND = PORTA.0
Symbol CAM = PORTA.1
Symbol SW = PORTB.5

Symbol AAN = 0
Symbol UIT = 1
Symbol On = 1
Symbol Off = 0

TRISA = %00000000 ; PORTA is output
TRISB = %11111111 ; PORTB is input

Clear

PORTA.0 = 1
PORTB_PULLUPS On

The new not working file:

Device 12F629
CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, MCLRE_OFF
ALL_DIGITAL TRUE

Symbol ZEND = GPIO.4
Symbol CAM = GPIO.5
Symbol SW = GPIO.2

Symbol AAN = 0
Symbol UIT = 1
Symbol On = 1
Symbol Off = 0

TRISIO = %11001111 ; 76543210, GPIO.4,5 output, GPIO.2 input

Clear

CAM = 0
ZEND = 1
PORTB_PULLUPS On

Anyone got any suggestions? What am I doing wrong here?

Thanks!

Archangel
- 22nd April 2011, 19:27
I would add:
ADCON0=0
ANSEL = 0
EDIT:
How sure about this config statement are you
CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, MCLRE_OFF
ALL_DIGITAL TRUE especially the All digital true statement? I ask because I am unable to check right now.
http://www.picbasic.co.uk/forum/showthread.php?t=543