G'Day! I am using jalv2 and jallib (currently jallib-pack-2.4n-0.6.0) on a PIC10f206 for a few weeks. What I found is that in the sample file '10f206_blink.jal' and the corresponding include-file '10f206.jal', which will probably be used by people as a starting point for their own programs, OSCCAL is never set.
To quote from the PIC10F206 data sheet, section 9.2.2: "In addition, a calibration instruction is programmed into the last address of memory, which contains the calibration value for the internal oscillator. This location is always uncode protected, regardless of the code-protect settings. This value is programmed as a MOVLW xx instruction where xx is the calibration value and is placed at the Reset vector. This will load the W register with the calibration value upon Reset and the PC will then roll over to the users program at address 0x000. The user then has the option of writing the value to the OSCCAL Register (05h) or ignoring it." This means, the very first instruction at location 0x000 should be a movwf OSCCAL instruction, unless the calibration value is to be ignored. There is, however, a problem: In the file '10F206.jal' (since I'm using the 10F206 device), there are declarations for three variables that are used for shadowing: var byte _PORTA_shadow = PORTA ... var byte _TRISA_shadow = 0b1111_1111 -- default all input ... var byte _OPTION_REG_shadow = 0b1111_1111 -- default all set which generate code to overwrite the initial oscillator calibration value in w, as set by the MOVLW instruction at 0x1ff. There are two ways to correct this: #1: Insert assembler movwf 5 end assembler just before the "include 10f206" (you cannot use "OSCCAL" here, because it gets defined in '10f206.jal' later) in file '10f206_blink.jal', or #2: insert 'movwf OSCCAL' in the '10f206.jal' include file before the first assignment that generates any code. Having assembler movwf OSCCAL end assembler before the var byte _PORTA_shadow = PORTA statement in '10f206.jal' will generate the correct code. This issue affects all 10fxxx devices. In my opinion, the include files should be changed accordingly. Any thoughts? Greetings, Karin -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
