View previous topic :: View next topic |
Author |
Message |
Homie
Joined: 11 Aug 2006 Posts: 11
|
|
Posted: Wed Aug 16, 2006 7:42 pm |
|
|
sorry Banana for the syntax errors, i made the code while i was writing. In C you all way have to finish your statements with a ; Execpt if it is a function, define, include or likes. And the the error rwyoung was talking about (and you also found yourself) was that there also have to be a delay after the toggle comand, or else it will toggle low and then high so fast that you cant see it
And a ICD is a In Circuit Debugger, the thing i ment was that if you program your chip ICSP (In Circuit Seriel Programming) you use some of your pins for that..
The blue text just mean that the compiler reconize the comand, all variables will be blue (integers, chars, bytes, void etc etc)
And as kender says if you want to write to the whole port at a time youll have to se it as a byte (hex) just like the set_tris comand i wrote (LessSignificantBit = port 0, the next = port 1 and so on. Just remember that with 6 ports the two MostSignificantBits have to be 0)
Hope i havent made you too confused with my bad syntax :P
-Thomas |
|
|
Jakin Guest
|
|
Posted: Thu Aug 17, 2006 2:43 pm |
|
|
Hi,All:
Can anyone tell how #fuse works for C language ? Thank you very much . |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Thu Aug 17, 2006 3:06 pm |
|
|
Jakin wrote: | Hi,All:
Can anyone tell how #fuse works for C language ? Thank you very much . |
It has nothing to do with C. The #fuses statement is an extension in the CCS compiler to allow the setting of a PIC's configuration bits.
Refer to the CCS C Compiler Reference Manual March 2006 page 42.
To learn about the configration bits for a particular PIC (for example a PIC18F2550) then go to
www.microchip.com, download the appropriate PIC's datasheet and read (and re-read, and re-re-read etc). _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Aug 17, 2006 4:56 pm |
|
|
Funky_Banana wrote: | Excellant, im learning fast! Ill be better than you lot before you know it lol! |
Doubt it
Last edited by Mark on Thu Aug 17, 2006 9:52 pm; edited 1 time in total |
|
|
Guest
|
|
Posted: Thu Aug 17, 2006 6:07 pm |
|
|
Mark wrote: | Funky_Banana wrote: | Excellant, im learning fast! Ill be better than you lot before you know it lol! |
Doubt is |
we all srated somewhere >> you probably asked the same questions when starting out |
|
|
theteaman
Joined: 04 Aug 2006 Posts: 98
|
|
Posted: Thu Aug 17, 2006 6:19 pm |
|
|
Anonymous wrote: | Mark wrote: | Funky_Banana wrote: | Excellant, im learning fast! Ill be better than you lot before you know it lol! |
Doubt is |
we all srated somewhere >> you probably asked the same questions when starting out |
Man arrives as a novice at each age of his life. -- Sebastien Chamfort |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Fri Aug 18, 2006 7:10 am |
|
|
Anonymous wrote: | Mark wrote: | Funky_Banana wrote: | Excellant, im learning fast! Ill be better than you lot before you know it lol! |
Doubt is |
we all srated somewhere >> you probably asked the same questions when starting out |
I think you missed out on the smiley, the international "Wisenheimer" symbol.
I asked the same questions but to myself and then RTFM'd them. But enthusiasm counts, even more so when tempered by the discipline to read the manual and datasheet first. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Funky_Banana
Joined: 16 Aug 2006 Posts: 9
|
|
Posted: Fri Aug 18, 2006 10:56 am |
|
|
Guys im ready to slit my wrists. I just want a bloody led to flash on a pic 12f629 and im finding it so difficult.
Ive pasted the code into CCS and clicked compile, it then spits out a hex file. I am then dumping the file onto the chip with my programmer. I have no problem with electronics and know my stuff, so the led etc is all connected ok, the chip is programming ok and ive check the hex is on the chip. My programmer has various options to click, Brown out, Watchdog etc, Which do i need to click.
My led will not flash, the pin is doing nothing on the scope.
The code used is as follows:
#include <12F629.h>
#fuses INTRC_IO, NOWDT, NOMCLR, PUT, BROWNOUT
#use delay(clock=4000000)
//==========================
void main()
{
while(1)
{
output_high(PIN_A0);
delay_ms(500);
output_low(PIN_A0);
delay_ms(500);
}
}
PLEASE HELPPPPPPPPPPPPPPPPPPPPPPPP!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Aug 18, 2006 11:06 am |
|
|
Well the first thing I would do is read the datasheet, most importantly the analog input section. Look at the ANSEL register. Look at the default values. You will notice that A0 is by default an analog input and not a digital i/o. Now CCS has functions to set this up but I don't like to use them because they are known to have problems. But their function is
setup_adc_ports( NO_ANALOGS ); You need to add this. You are also not setting up the data direction registers either (TRIS). CCS handles this by default but I like to do this myself with the #use fast_io directive. The problem is that if you move to a different compiler, you will be lost again since all this "magic stuff" that happens makes the programmer lazy and ignorant of what needs to be done. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 18, 2006 12:08 pm |
|
|
Post your compiler version. The program that I posted was tested with
vs. 3.249. As Mark says, if you have an earlier version, the CCS
start-up code may not be correct. The version will be a number such
as 3.191, or 3.236, or 3.249, etc. Look at the top of the .LST file to
find the version number. The .LST file is in your project folder. |
|
|
jakin
Joined: 17 Aug 2006 Posts: 6
|
|
Posted: Fri Aug 18, 2006 12:38 pm |
|
|
My version is 3.246 ,but I do know this complier will work or not. ANY comments . |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 18, 2006 12:45 pm |
|
|
Are you saying that Jakin = Funky Banana ? |
|
|
jakin
Joined: 17 Aug 2006 Posts: 6
|
|
Posted: Fri Aug 18, 2006 12:53 pm |
|
|
I am not funky banana ... I am just anoter person |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 18, 2006 12:55 pm |
|
|
This is his thread. My request for a compiler version number was
in response to his recent post:
Quote: | I just want a bloody led to flash on a pic 12f629 and im finding it so difficult. |
|
|
|
|