PIC Assembler 12F683 W Register Memory Map Location

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Here's the plan

Write code snippet to load register with a value.

Program the chip.

Look with IPE for the value.

12F683 choice is tentative. If it needs calibration adjustment. Forget it. Will use PIC 16F886.

What address is W register at?

Going off to look at 12F683 data sheet.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
'Factory calibrated to ±1%, typical'

That's the same line 10F200 and 12F508 have in datasheet. Forget the 12F683.

16F886 it is.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
RESET_VECTOR CODE 0xFF ; processor reset vector

; Internal RC calibration value is placed at location 0xFF by Microchip
; as a movlw k, where the k is a literal value.

MAIN CODE 0x000
movwf OSCCAL ; update register with factory cal value

Here's the code from a 10F200 Microchip MPASM templat. Will check 12F683 next.
 

be80be

Joined Jul 5, 2008
2,072
The only osscon setting is to change the speed of the osc.
This is 12f683
Code:
; TODO INSERT CONFIG CODE HERE USING CONFIG BITS GENERATOR

RES_VECT  CODE    0x0000            ; processor reset vector
    GOTO    START                   ; go to beginning of program

; TODO ADD INTERRUPTS HERE IF USED

MAIN_PROG CODE                      ; let linker place main program

START

    GOTO $                          ; loop forever

    END
See
MOVLW 70h
MOVWF OSCCON
 
Last edited:

be80be

Joined Jul 5, 2008
2,072
This stuff not that hard the only problems I've seen is with the baseline chips
the 12f683 is good chip there not much reason to mess with calibration your reading to much.
Baseline chips are not that hard too.
I posted for the 12f683
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Max Thank you!

Not sure what you mean.

Plan is to write just anything into W register and then see if it worked.

Want to get a away from 'calibration value' baseline PIC's for the moment.

BTW PICKit 2 is a sore subject at the moment.:) Thats a joke!
 
Last edited:

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Bebe

For the 12F683. Good. Will look no further.

Will continue this in the morning.

1 Write code snippet.

2 Compile/Program

3 Check with IPE and see if it works.
 

OBW0549

Joined Mar 2, 2015
3,566
'Factory calibrated to ±1%, typical'

That's the same line 10F200 and 12F508 have in datasheet. Forget the 12F683.

16F886 it is.
The internal oscillator in the PIC16F886 is factory calibrated to ±1%, too. That is the level of accuracy most PIC internal oscillators are calibrated to, and if you're searching for anything better you're out of luck.

I have to ask: what the bloody hell are you doing??? You're hopping around aimlessly like a grasshopper on meth, jumping from one processor to another to another for no apparent logical reason. Last I saw you, you were engaged in a titanic struggle to blink an LED using a PIC12F508. Did you ever get that working? Have you succeeded in programming any PIC yet, with code that actually does something?

As @be80be has said, this stuff is really NOT that hard. It's certainly not hard enough to explain why, after more than a month of effort, you're still struggling to accomplish something most newbies achieve in just a day or two-- or even just a few hours.

If you really want to accomplish something, get yourself out of "Thrash Mode": pick ONE processor chip and stick with it; read its documentation thoroughly, including Microchip's "Quick Start" guides; stop distracting yourself with meaningless trivia like whether the PIC's internal oscillator is accurate enough; and proceed logically, step by step.

And more than anything else, force yourself to FOCUS.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
QBW

Thank you for helping in your own way.

The issue with 10F200 and the like is the lines of code mandatory to get it to work

NOT how accurate it is.

In a late night session I think I finally understand how MOV instructions work.

We can probably just stick it out with 10F200.

Just have to sort out a thing or two about those lines of code.

Microchip MPASM templates do it one way and Gooligum tutorial does it slighty different.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Here's the beginning of the differences. This is config line from template.

__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF

Line in Gooligum adds '&_IntRC_OSC' on the end.

He puts that in and doesn't tell you he did.

Its not in my current 10F200 template.
 

OBW0549

Joined Mar 2, 2015
3,566
Its not in my current 10F200 template.
There's a damned good reason-- and an obvious one, at that-- why it's not in Microchip's PIC10F200 code template: the PIC10F200 doesn't even have any configuration setting for the oscillator, because it has only one oscillator, INTOSC. There is no configuration bit for the oscillator, only for MCLR enable, code protection, and watchdog timer. See pages 35 and 36 of the data sheet.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
OBW Thanks!

Okay. Here are lines from Microchip template.

RESET_VECTOR CODE 0xFF ; processor reset vector

; Internal RC calibration value is placed at location 0xFF by Microchip
; as a movlw k, where the k is a literal value.

MAIN CODE 0x000
movwf OSCCAL ; update register with factory cal value

What is each line of code actually doing?

RESET_VECTOR? Is that a command? A varible?

I have seen the calibration value in the last address in IPE.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
OBW

'spoon-feed someone on anything that simple'

You say 'spoon feed'. I say 'explain'.

Sure it's simple.Do I know what it means? NO!

Are there any paragraphs clearly explalning RESET_VECTOR with a few repetitive examples? NO!

I am attempting to figure this out so it's bullet proof and

we can write code with confidence.

I think its a good plan.
 

Papabravo

Joined Feb 24, 2006
21,264
There's a damned good reason-- and an obvious one, at that-- why it's not in Microchip's PIC10F200 code template: the PIC10F200 doesn't even have any configuration setting for the oscillator, because it has only one oscillator, INTOSC. There is no configuration bit for the oscillator, only for MCLR enable, code protection, and watchdog timer. See pages 35 and 36 of the data sheet.
He must have thought all PICs were the same.
AFAIK, the W register does not have a register file address.
If you look at the core block diagram you see the W register, implemented in the hardware, as the receiver of the ALU output. The output of the W register also loops back to one of the ALU inputs. W is always one of the (implied) inputs to ANY ALU operation.
 

MaxHeadRoom

Joined Jul 18, 2013
28,782
Rather than everyone repeat what has been thrashed over here before in detail, just use the search panel at the top right and plug in OSCCAL, you will get all you need!!
Max.:rolleyes:
 
Top