908JL16 RC clock option configuration problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

908JL16 RC clock option configuration problem

2,483 Views
popup
Contributor I
hi,all
 
908JL16 has a alternative OSC input of RC circuit. In datasheet, clearing the OSCSEL in MOR will force the RC oscillator to be the osc signal.
I write "MOR_OSCSEL=0;" in the beginning of main.c with CW5.1HC08 and the compiler error indicates the OSCSEL is a const var and will not be modifiable.
 
I just need to use the RC osc instead of a XTAL in cost-sensitive project. And I believe that JL16 has this feather, but I don't know how to initialize it.
 
How can I do that?
 
Regards,
popup :smileytongue:
 
 
Labels (1)
0 Kudos
7 Replies

485 Views
peg
Senior Contributor IV
Hi popup,
 
The MOR register is implemented in flash. So it has to be 'programmed', usually at the same time as you programme your code into flash. It cannot be altered simply by writing to it from your code.
 
0 Kudos

485 Views
popup
Contributor I
Hi,Peg

I understand that this bit should be programmed in flash,but how?
can you explain by steps?
Thank you for advance.
 
 
Regards,
popup

0 Kudos

485 Views
peg
Senior Contributor IV
Hi popup,
 
I know exactly what to do at a device level, however I don't know with confidence how to explain that to Codewarrior in C.
This subject has been explained recently (possibly in CW forum) and I think it was actually for the FLBPR but the principle will be the same. I will leave you to do the searching.
 
0 Kudos

485 Views
popup
Contributor I
Hi, peg
 
I assume the MOR in flash is @FB00 and RC option for MOR is set to be 0x7f.
I use Program Byte command in burnner to Program the byte @FB00 to be 0x7f.
 
Will that work?
 
 
Regards,
popup
 
0 Kudos

485 Views
peg
Senior Contributor IV
Hi,
 
You might be able to but I meant you to put it in to your c programme.
 
I assembler you would do this
 
 org MOR
 db $7F
 
I don't normally use C and I don't use Codewarrior. Post a question about this in 8-bit CW forum
 
0 Kudos

485 Views
Alban
Senior Contributor II
Hello,

The syntax is:

const unsigned char REGISTER @ 0xADDRESS = VALUE;

To be written in the same place as global variable.
Will create a warning as it overlaps the decalred Flash area. No worry.

Cheers,
Alban.
0 Kudos

485 Views
popup
Contributor I
Hi, all
 
The correct operation in CW08 v5.1 to setup MOR or FLBPR for 908JL16 should be:
 
Code:
const byte MOR_INIT @0x0000FFD0 = 0x7f; //set MOR to use RC oscconst byte FLBPR_INIT @0x0000FFCF =0xff; //unprotect all flash

 It is important to remember 3 points:
1. add "const" to indicate MOR or FLBPR is in flash
2. use MOR_INIT instead of MOR and FLBPR_INIT instead of FLBPR,this is described in .h file related to the specific 908mcu.
3. when using other 908mcu, check the address of MOR and FLBPR in their datasheet and modify them to the right value.
0 Kudos