Searching \ for '[PIC]: AD 12F675 lockup' 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/microchip/devices.htm?key=pic
Search entire site for: 'AD 12F675 lockup'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: AD 12F675 lockup'
2003\02\08@084729 by John Snider

picon face
I had previously asked about a/d lockup when very near Vdd:
"...except when the input voltage gets near +5, the 12F675 "locks" up,"

Please ignore the question, I discovered that if the a/d value was 255, the
program would go off the end of my lookup table - because the table only
has 254 entrys due to the addwf PCL,f at the start, therefore it exceeeds
the page when at 255. As my output is interrupt driven, the output looked
normal but wouldn't respond.
------------------------------------------
               org 0x0200
MSB_Period
                  addwf  PCL,f
                  retlw  0xXX
                  (252 other retlw 0xXX) retlw  0xXX
                  (0x300 page)
--------------------------------------
I didn't count the fence posts correctly :)
John Snider

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\08@092029 by Olin Lathrop

face picon face
> Please ignore the question, I discovered that if the a/d value was 255,
the
> program would go off the end of my lookup table - because the table only
> has 254 entrys due to the addwf PCL,f at the start, therefore it
exceeeds
> the page when at 255. As my output is interrupt driven, the output
looked
> normal but wouldn't respond.
> ------------------------------------------
>                 org 0x0200
> MSB_Period
>                    addwf  PCL,f
>                    retlw  0xXX
>                    (252 other retlw 0xXX) retlw  0xXX
>                    (0x300 page)

This comes up periodically.  Now that you've been penny wise and pound
foolish, do youself a favor and spend the little extra effort to do table
lookups the right way.  The only excuse is the rather rare case where you
can't afford the few extra instructions or cycles.  This table lookup code
has no restriction as to where the code or table resides in program
memory:

;
;   Return to the caller with the table value in W for the
;   0-255 table entry number in OFFSET.  The bank must
;   already be set for access to OFFSET.
;
   movlw   high table   ;get table start address high byte
   movwf   pclath       ;init jump address high byte
   movf    offset, w    ;get the 0-255 table entry offset
   addlw   low table    ;make jump address low byte
   skip_nc              ;no carry into high byte ?
   incf    pclath       ;propagate the carry
   movwf   pcl          ;jump to the selected table entry

...

table
   retlw ...
   ...


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\08@094705 by Bob Ammerman

picon face
Or, if you know you have 256 entries in your table:

my_table_lookup:
   movlw    high(my_table_data)
   movwf    PCLATH
   movf       table_index,W
   movwf    PCL

   org        X'300'        ; use last 'page' for table

my_table_data:
   retlw    X'??'
   254 more entries
   retlw    X'??'

{Original Message removed}

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