![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I am just starting my first MPLAB/C18 project. I've done tons of PIC programming before, but never with MPLAB, never with C18, and never with an 18 series PIC.
I have a new project set up and I am trying to get the basics working before I get out the bread board and really get down to business. The code that I currently have working doesn't seem to transfer to the simulator properly. PORTA and OSCCON do not change to the variables I tell them to. I've attached a screen shot to describe what I mean a little more. My final target will be a PIC18LF4423 chip. Any ideas? |
|
|
|
|
|
|
(permalink) |
|
I'm new to C18 too, but I recall you use the linker with the i in it. ex PIC18LF4423i.lnk for debug.
|
|
|
|
|
|
|
(permalink) |
|
Thanks for the suggestion. I tried that adjustment, with the same results.
I was under the impression that you use the i when you are using the ICD2? I am probably wrong on that, I will try to see if I can find out the right answer. In this scenario I am using the built in "MPLAB SIM" Debugger |
|
|
|
|
|
|
(permalink) |
|
I ran the simulation on MPLAB (I use a 18F1320 as I'm familiar with it) your simulation seems right. You may have to disable A/D, CMCON that sort of thing with your PIC first.
Code:
#include <p18cxxx.h>
void main(void)
{
OSCCON = 0x72;
TRISA = 0x00;
PORTA = 0xFF;
}
|
|
|
|
|
|
|
(permalink) |
|
You are probably right, I need to look into the A/D, CMCON, etc. more.
I hooked up the real chip to the code, and programmed it. It isn't switching _any_ of the pins high. I assume this is because I haven't set the config or data fuses. To tell it that in in INTRC, etc. Looking through the datasheet, it seems like I need to set "CONFIG1H". I set CONFIG1H to the proper values by: #pragma 0x300001 0b00001000 any ideas? Last edited by Fred.Amoson; 6th February 2008 at 07:23 PM. |
|
|
|
|
|
|
(permalink) |
|
This might help
http://www.voti.nl/pickit2faq/files/boot_main.c |
|
|
|
|
|
|
(permalink) |
|
Thanks, got the ports blinking. Should be all good from here.
|
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| RF newbie..electronics newbie | jbchrist | General Electronics Chat | 4 | 17th May 2007 02:14 PM |
| Newbie here | zenpcs | Chit-Chat | 2 | 16th October 2006 06:21 AM |
| Newbie Question on NPN Transistors | arrow | General Electronics Chat | 27 | 27th July 2006 03:15 AM |
| newbie | kelvinko | Robotics Chat | 2 | 15th August 2003 12:57 PM |
| newbie newbie newbie | Bentov | General Electronics Chat | 8 | 1st May 2003 12:15 PM |