Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - INTOSC oscilator on PIC16F88

(you are viewing a thread; or go back to list of threads)

INTOSC oscilator on PIC16F88 (by Peter van Hoof)
I'm really impressed with the great software, Thank you!

I'm trying to use the internal oscilator on the 16f88 but have a problem. While it is possible enable the internal oscilator with the fuse settings in my programmer it starts up at 32Khz speed, to switch it to 8Mhz you need to write a value to OSCCON

It would be nice if you could start the ladder with something like:

initcode 3080008F

or set some init code bytes in the MCU Parameters screen


Peter van Hoof
Fri May 7 2010, 18:09:39
New idea (by Peter van Hoof)
I just had a new idea of how to do this
you could add an addressing mode for this in the mov command:

_ {addr0x8f :=}
-----[OSR_/ ]-------------------------------{ 0x80 MOV}-



Peter van Hoof
Fri May 7 2010, 19:35:43
OSCCON (by Bret Barker)
Did this actually work? I've programed a basic ladder but can't see this word actually being written to 0x8f.
Wed May 26 2010, 19:08:47
osccon (by Peter van Hoof)
These where suggestions on the syntax for how some initcode could be implemented in future versions of ldmicro, currently somethimng like this is not implemented.

I have written a small script for autoit (=freeware) that takes a hex file generated by ldmicro.exe version 2.1 for the PIC16f88 (i have not tested it with other versions that may generate a different hex file). it changes the code at the start to enable the internal oscilator (config bytes) set the oscilator to 8 mhz (osccon=0x70) and enable the weak pullups on port b )so i can read switches with just a switch connected between ground and an input pin on port b.

The script opens a file open dialog when run without parameters to select the hex file to be patched. after patching the hex file is modified and saved as
originalfilename_patched.hex

a second way to select the file is to compile the script with autoit and drag a hex file on top of the compiled script
(this takes the file and saves it with the name as above)
It was actually a little different than i suggested in my previous email you have to switch to bank 1 to write to osccon and back after.

I have attached the script to this message, feel free to use it for whatever (public domain use at your own risk)

Peter van Hoof <[email protected]>
ps: I need a engineering job in the Scranton PA area
http://www.linkedin.com/in/pvhoof
Fri May 28 2010, 22:04:11, download attachment hex_patcherv3.au3
Hex patcher script for PIC16f88 (by Peter van Hoof)
I forgot to mention in the post where to download autoit freeware to run the script (and I did not want to post a compiled script on the forum)

http://www.autoitscript.com/
It's IMHO one of the greatest scripting languages for windows available and I use it every day.

If you prefer to get a compiled script so you don't have to install autoit I can E-mail it to you, just send me a mail at [email protected]

Peter
Sat May 29 2010, 00:11:37
(no subject) (by BoumPower)
The pullup are good idea ! It's a important feature of MCU.

I will include them in my new LDmicroCompiler.

I suggest Jonathan to add this in the ld file format as

Xbutton at 21 1 (1 means pullup enabled)

or better, as suggested some month ago, to change the target syntax and have for inputs :
INPUT Xbutton PortD:#2 1

Best regards
Sat May 29 2010, 01:44:30
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):