PDA

View Full Version : Convert code 12C508 to 12F508



Olivier
- 25th October 2009, 09:29
Hello,

I am new in the forum, My name is Olivier, and I like electronic and my passion of electric trail, scale HO (1/87).
I hope somebody can help me about PIC 12F508.
I have a file XXX.asm and XXX.hex for a PIC 12C508, It's a program for "Decoder for Locomotive"(see attachement files)
but this PIC is obselete now, and I Would like use a PIC 12F508.
I would like to know how I can do for convert my file XXX.asm or XXX.hex for use with my PIC 12F508?
I am new on program PIC, I have a programmer PIC and MPLAB

In advance thanks you

Olivier

ScaleRobotics
- 25th October 2009, 15:53
This should be 100% compatible with your code. Well, at least 99%.

I did notice that it would not compile with my mpasm. They use a variable called CONFIG, and this is in the first column. Mpasm does not like this. So I renamed it SETTINGS, and it compiles fine. Should operate fine too, but you will have to check that out.



LIST P=12F508 ; target processor
#include "P12F508.INC" ; include Header file

__CONFIG _CP_OFF & _WDT_OFF & _MCLRE_OFF & _IntRC_OSC



;************************************************* *****
MYADRESS equ 0x44 ; DECODER ADDRESS because there is no EEPROM yet

;************************************************* *****
; RAM locations

SETTINGS equ 0x07 ; Contains various bits to test
MOTMASK equ 0x08 ; Motormask for direction
PWM equ 0x09 ; How long is motor on
PRECOUNT equ 0x0B ; Preamble counter
STATE equ 0x0C ; Where are we in the DCC package
DATA1 equ 0X0D ; First transm. byte
DATA2 equ 0x0E ; Second trans. byte
DATA3 equ 0x0F ; Third transm. byte
DATA5 equ 0x10 ; Scratch Register
SAMPLES equ 0x11 ; How many samples taken for one or zero
DAT2OLD equ 0x12 ; Save previous DATA to compare

;************************************************* *****

Acetronics2
- 25th October 2009, 16:19
Hi, Olivier de Lyon

No use to bomb each and every forum ... French or internationnal ...

Alain