CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

H E L P - 12F629 LED BLINK CODE NEEDED, PLEASE, PLEASE
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Homie



Joined: 11 Aug 2006
Posts: 11

View user's profile Send private message

PostPosted: Wed Aug 16, 2006 7:42 pm     Reply with quote

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 Smile

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







PostPosted: Thu Aug 17, 2006 2:43 pm     Reply with quote

Hi,All:
Can anyone tell how #fuse works for C language ? Thank you very much .
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Aug 17, 2006 2:49 pm     Reply with quote

See this thread on fuses:
http://www.ccsinfo.com/forum/viewtopic.php?t=24336
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Thu Aug 17, 2006 3:06 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Aug 17, 2006 4:56 pm     Reply with quote

Funky_Banana wrote:
Excellant, im learning fast! Ill be better than you lot before you know it lol!


Doubt it Cool


Last edited by Mark on Thu Aug 17, 2006 9:52 pm; edited 1 time in total
Guest








PostPosted: Thu Aug 17, 2006 6:07 pm     Reply with quote

Mark wrote:
Funky_Banana wrote:
Excellant, im learning fast! Ill be better than you lot before you know it lol!


Doubt is Cool


we all srated somewhere >> you probably asked the same questions when starting out
theteaman



Joined: 04 Aug 2006
Posts: 98

View user's profile Send private message

PostPosted: Thu Aug 17, 2006 6:19 pm     Reply with quote

Anonymous wrote:
Mark wrote:
Funky_Banana wrote:
Excellant, im learning fast! Ill be better than you lot before you know it lol!


Doubt is Cool


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

View user's profile Send private message Send e-mail

PostPosted: Fri Aug 18, 2006 7:10 am     Reply with quote

Anonymous wrote:
Mark wrote:
Funky_Banana wrote:
Excellant, im learning fast! Ill be better than you lot before you know it lol!


Doubt is Cool


we all srated somewhere >> you probably asked the same questions when starting out


I think you missed out on the Cool 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

View user's profile Send private message

PostPosted: Fri Aug 18, 2006 10:56 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Fri Aug 18, 2006 11:06 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 18, 2006 12:08 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 18, 2006 12:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 18, 2006 12:45 pm     Reply with quote

Are you saying that Jakin = Funky Banana ?
jakin



Joined: 17 Aug 2006
Posts: 6

View user's profile Send private message

PostPosted: Fri Aug 18, 2006 12:53 pm     Reply with quote

I am not funky banana ... I am just anoter person
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 18, 2006 12:55 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group