Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

help for pic12c508a

Status
Not open for further replies.
When you ask a question... To help us to help you... We need to know what you need ie... what language you will use.... what you want to flash...etc..

Nigel's tutorial 1 will help you to turn a pin on and off.... If you have NEVER programmed a pic before... start there.
 
I don't think Nigels tutorials are the best place to start with that chip you can only program it one time.
And there not the easiest chip to use. I would try to get a 12F chip there re programmable.

If you still want to use that chip I would have a look at https://www.gooligum.com.au/tut_baseline.html He shows how to use base line chips

Here a sample from gooligum's I changed it to your chip 12C508a

This was coded by Author: David Meiklejohn Company: Gooligum Electronics

I just made changes for your chip I would go threw Davids tutorials if you want to use Base Line chips.
Code:
;************************************************************************
;                                                                       *
;   Filename:      BA_L2-Flash_LED.asm                                  *
;   Date:          8/9/07                                               *
;   File Version:  1.0                                                  *
;                                                                       *
;   Author:        David Meiklejohn                                     *
;   Company:       Gooligum Electronics                                 *
;                                                                       *
;************************************************************************
;                                                                       *
;   Architecture:  Baseline PIC                                         *
;   Processor:     12C508a/509                                           *
;                                                                       *
;************************************************************************
;                                                                       *
;   Files required: none                                                *
;                                                                       *
;************************************************************************
;                                                                       *
;   Description:    Lesson 2, example 1                                 *
;                                                                       *
;   Flashes a LED at approx 1 Hz.                                       *
;   LED continues to flash until power is removed.                      *
;                                                                       *
;************************************************************************
;                                                                       *
;   Pin assignments:                                                    *
;       GP1 - flashing LED                                              *
;                                                                       *
;************************************************************************

    list        p=12C508a      
    #include    <p12C508a.inc>

                ; ext reset, no code protect, no watchdog, 4Mhz int clock
    __CONFIG    _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC


;***** VARIABLE DEFINITIONS
        UDATA
sGPIO   res 1                   ; shadow copy of GPIO
dc1     res 1                   ; delay loop counters
dc2     res 1


;************************************************************************
RESET   CODE    0x000           ; effective reset vector
        movwf   OSCCAL          ; update OSCCAL with factory cal value 


;***** MAIN PROGRAM

;***** Initialisation
start	
        movlw   b'111101'       ; configure GP1 (only) as an output
        tris    GPIO

        clrf    sGPIO           ; start with shadow GPIO zeroed

;***** Main loop
flash
        movf    sGPIO,w         ; get shadow copy of GPIO
        xorlw   b'000010'       ; flip bit corresponding to GP1 (bit 1)
        movwf   GPIO            ; write to GPIO
        movwf   sGPIO           ; and update shadow copy

        ; delay 500ms
        movlw   .244            ; outer loop: 244 x (1023 + 1023 + 3) + 2
        movwf   dc2             ;   = 499,958 cycles
        clrf    dc1             ; inner loop: 256 x 4 - 1
dly1    nop                     ; inner loop 1 = 1023 cycles
        decfsz  dc1,f
        goto    dly1
dly2    nop                     ; inner loop 2 = 1023 cycles
        decfsz  dc1,f
        goto    dly2
        decfsz  dc2,f
        goto    dly1

        goto    flash           ; repeat forever


        END

And no I not saying Nigels tutorial are not good. """There Great""""
I'm only saying that the one's David wrote are for the Base Line Chips.
 
Last edited:
firstly thank you for your reply to my object , secondly i know programming in pic 16 Family only but i new program in 12 Family so i am search in this object and found my goal . thanks for all of my brothers .
 
Status
Not open for further replies.

Latest threads

Back
Top