Convert code 12C508 to 12F508


Closed Thread
Results 1 to 3 of 3
  1. #1
    Olivier's Avatar
    Olivier Guest

    Default Convert code 12C508 to 12F508

    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
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    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.

    Code:
            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
    
    ;******************************************************
    http://www.scalerobotics.com

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink

    Hi, Olivier de Lyon

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

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. How do you convert an algorithm to code?
    By boroko in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st April 2009, 02:22
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. convert code "c" lcd graphic to pbp
    By nicolasronan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th June 2006, 15:49

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts