Searching \ for '12c508 problems' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=12c508+problems
Search entire site for: '12c508 problems'.

Truncated match.
PICList Thread
'12c508 problems'
1999\11\16@072019 by Graham North

flavicon
face
I am have problems with a simple program to make leds flash with a 508.  The
program simulates correctly, but when programmed the chip does nothing.

Please can someone help me, it is probably something simple but I can not
see for looking!

Graham

Here is the code:


       list    p=12c508
       include "p12c508.inc"

       radix   dec

       __FUSES _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC

       cblock  0x07    ;Store variables above control registers

       TICKS
       RTCC

       endc

       org     0x00            ;Start of code space

SAME    equ     1

Led1    equ     0       ;LED 1 connected to GP bit 0
Led2    equ     1       ;LED 2 connected to GP bit 1

;************************** Main ********************************

       movfw   0x1ff
       movwf   OSCCAL          ;Set oscillator calibration reg.

start
       movlw   b'11000010'     ;Set TMR0 prescaler = 1:8 (f_osc=4MHz)
       option                  ;/

       movlw   b'00000000'     ;Make all port bits outputs
       tris    GPIO            ;/


Again                           ;do
       bsf     GPIO,Led1       ;  Led1 on
       call    Wait_1sec       ;  Wait one sec
       bcf     GPIO,Led1       ;  Led1 off
       call    Wait_1sec       ;  Wait one sec
       bsf     GPIO,Led2       ;  Led2 on
       call    Wait_1sec       ;  Wait one sec
       bcf     GPIO,Led2       ;  Led2 off
       call    Wait_1sec       ;  Wait one sec

       goto    Again

;----------------------- SUBROUTINES -----------------------

Wait_1sec
;One second delay subroutine
;Generates delay by calling 5ms delay 200 times

       movlw   .200            ;Init counter for 1 sec
       movwf   TICKS

One_less                        ;do
       call    Wait_5ms        ;  wait 5 ms
       decf    TICKS,SAME      ;  decrement counter
       btfss   STATUS,Z        ;while (count<>0)
       goto One_less
       return

Wait_5ms
Delay subroutine using the timer, 4Mhz Xtal, 32 prescaler
Generates a delay of 5ms if Rtcc preloaded with 100

Wait_5ms                        ;do
       movlw   .100            ;  Rtcc = 225
       movwf   RTCC
Timer_check                     ;do
       movf    RTCC,W          ;  read Rtcc
       btfss   STATUS,Z
       goto    Timer_check     ;while (Rtcc<>0)
       return


       end

1999\11\17@013418 by Ravi Pailoor

flavicon
face
part 0 3441 bytes content-type:text/x-vcard; charset=us-ascii; (decoded 7bit)

Mask out

;         movfw   0x1ff         ; remove this line, the W is automatically
loaded.
         movwf   OSCCAL          ;Set oscillator calibration reg. ( let
this be there )

Regards

Pailoor

Graham North wrote:
{Quote hidden}

--
WE DESIGN THE FUTURE
Website : http://www.chiptechnologies.com
Website : http://business.vsnl.com/chiptech
Content-Type: text/x-vcard; charset=us-ascii;
name="chiptech.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ravi Pailoor
Content-Disposition: attachment;
filename="chiptech.vcf"

Attachment converted: wonderland:chiptech.vcf 1 (TEXT/CSOm) (0000F8A5)

1999\11\17@021721 by Quentin

flavicon
face
Graham North wrote:

> Here is the code:
>
>         list    p=12c508
>         include "p12c508.inc"
>
>         radix   dec
>
>         __FUSES _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC
>
>         cblock  0x07    ;Store variables above control registers
>
>         TICKS
>         RTCC
>
>         endc
>
;         org     0x00            ;Start of code space
do not put it here, see below
>
> SAME    equ     1
>
> Led1    equ     0       ;LED 1 connected to GP bit 0
> Led2    equ     1       ;LED 2 connected to GP bit 1
>
> ;************************** Main ********************************
>
;         movfw   0x1ff <--- wrong, should be:
         org     0x1ff         ;goto end of memory, there you will get oscal va
lue
>         movwf   OSCCAL          ;Set oscillator calibration reg.
>
If you are using a Windows 12Cxxx, I hope you remembered to write down
the Oscal value before you use or erase it for the first time. Read the
blank 12Cxxx with your programmer, go to the  end of the listing (ie:
address 0x1ff), you will see Cxx  (0xCxx) 0xC is hex for movlw and the
xx will be the Oscal value. Write it down! If you erased the PIC without
writing it down, you don't know what the Oscal value is, and I believe
it is a pain to figure out what it is.
Your programmer proggy should have a function where you can re-enter the
Oscal value.

       org     0x00    ;now you go to top of program space
{Quote hidden}

This will work. You do get a command "decfsz" that will do the above two
lines for you.
{Quote hidden}

Hope it helps
Quentin

1999\11\17@084124 by J Nagy

flavicon
face
Graham North wrote:

>I am have problems with a simple program to make leds flash with a 508.  The
>program simulates correctly, but when programmed the chip does nothing.
>

Offhand, ignoring syntax that I'm not familiar with, I can see two things
that I'd look at:

>        org     0x00            ;Start of code space

>;************************** Main ********************************
>
>        movfw   0x1ff
>        movwf   OSCCAL          ;Set oscillator calibration reg.


Microchip has been kind enough to place a MOVLW <osccal const> at location
$1FF, the startup vector, for you. When the chip reaches location $000, all
you need to do is MOVWF OSCCAL (if you intend to use the internal
oscillator). Eliminate your first line.


>Wait_5ms                        ;do
>        movlw   .100            ;  Rtcc = 225
>        movwf   RTCC
>Timer_check                     ;do
>        movf    RTCC,W          ;  read Rtcc
>        btfss   STATUS,Z
>        goto    Timer_check     ;while (Rtcc<>0)
>        return


You've defined RTCC as register 8, but don't do anything with it for it to
ever become zero. Were you perhaps thinking of register 1 (TMR0)?

Hope this has been helpful,


       Jim Nagy
       Elm Electronics
 ICs for Experimenters
http://www.elmelectronics.com/

1999\11\18@044833 by Dr. Imre Bartfai

flavicon
face
Hi,
two additional remarks:

the 1st line is bogus even if you want to set OSCCAL manually, as the
statement

       movfw   0x1ff

makes no sense.

> >        movlw   .100            ;  Rtcc = 225

It will load decimal 100 to W instead of 225 or whatever you intended.

I hope this helps.

Regards,

Imre


On Wed, 17 Nov 1999, J Nagy wrote:

{Quote hidden}

1999\11\18@051338 by Graham North
flavicon
face
Thanks everyone for the suggestions, will try them as soon as I get time!

GRAHAM

       ----------
       From:  Dr. Imre Bartfai [SMTP:spam_OUTrootTakeThisOuTspamPROF.PMMF.HU]
       Sent:  18 November 1999 09:49
       To:  .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
       Subject:  Re: 12c508 problems

       Hi,
       two additional remarks:

       the 1st line is bogus even if you want to set OSCCAL manually, as
the
       statement

               movfw   0x1ff

       makes no sense.

       > >        movlw   .100            ;  Rtcc = 225

       It will load decimal 100 to W instead of 225 or whatever you
intended.

       I hope this helps.

       Regards,

       Imre


       On Wed, 17 Nov 1999, J Nagy wrote:

       > Graham North wrote:
       >
       > >I am have problems with a simple program to make leds flash with
a 508.  The
       > >program simulates correctly, but when programmed the chip does
nothing.
       > >
       >
       > Offhand, ignoring syntax that I'm not familiar with, I can see two
things
       > that I'd look at:
       >
       > >        org     0x00            ;Start of code space
       >
       > >;************************** Main ********************************
       > >
       > >        movfw   0x1ff
       > >        movwf   OSCCAL          ;Set oscillator calibration reg.
       >
       >
       > Microchip has been kind enough to place a MOVLW <osccal const> at
location
       > $1FF, the startup vector, for you. When the chip reaches location
$000, all
       > you need to do is MOVWF OSCCAL (if you intend to use the internal
       > oscillator). Eliminate your first line.
       >
       >
       > >Wait_5ms                        ;do
       > >        movwf   RTCC
       > >Timer_check                     ;do
       > >        movf    RTCC,W          ;  read Rtcc
       > >        btfss   STATUS,Z
       > >        goto    Timer_check     ;while (Rtcc<>0)
       > >        return
       >
       >
       > You've defined RTCC as register 8, but don't do anything with it
for it to
       > ever become zero. Were you perhaps thinking of register 1 (TMR0)?
       >
       > Hope this has been helpful,
       >
       >
       >         Jim Nagy
       >         Elm Electronics
       >   ICs for Experimenters
       > http://www.elmelectronics.com/
       >
       >

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...