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 support@ccsinfo.com

how to start

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
seyyah
Guest







how to start
PostPosted: Sat Jun 21, 2003 1:25 pm     Reply with quote

I know pic assembly and i know c. but i didn't write any pic code in c before. So can you suugest me a good source to start?
A simple tutorial helps to learn general aspects and a complete reference helps to find needed subjects.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515442
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

Re: how to start
PostPosted: Sat Jun 21, 2003 5:09 pm     Reply with quote

:=I know pic assembly and i know c. but i didn't write any pic code in c before. So can you suugest me a good source to start?
:=A simple tutorial helps to learn general aspects and a complete reference helps to find needed subjects.

If you have the CCS compiler, there are many examples and include files in the 'examples' directory to get you started.
Here's a list:

<a href="http://www.ccsinfo.com/exlist.html" TARGET="_blank">http://www.ccsinfo.com/exlist.html</a>

The compiler comes with a reference book, although not complete. This forum is a valuable source of information to fill in the gaps.
As an occasional user and non-specialist I can recommend the compiler very highly (I have PCW).

Start by getting a led to flash on a port pin using the delay_ms() and output_bit() functions and build up from there.
Good old printf debugging on the serial port is very useful too.

Regards
Kenny
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515443
seyyah
Guest







Re: how to start
PostPosted: Sun Jun 22, 2003 10:09 am     Reply with quote

Can you please write me a code for 16f877 which turns on a led connected to the first bit of portb?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515449
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

Re: how to start
PostPosted: Sun Jun 22, 2003 5:45 pm     Reply with quote

<font face="Courier New" size=-1>:=Can you please write me a code for 16f877 which turns on a led connected to the first bit of portb?

//Program flashes led on port b0

#include <16F877.h>

// Tell delay routines which crystal frequency (set to suit your crystal)
#use delay(clock=16000000)

// See manual for these settings
#fuses HS,NOWDT,PUT,NOLVP

void main()
{

output_b(0); // First clear all port b bits

while(1)
{
output_bit(PIN_B0,1);
delay_ms(500);
output_bit(PIN_B0,0);
delay_ms(500);
}
}</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515456
seyyah
Guest







Re: how to start
PostPosted: Mon Jun 23, 2003 11:21 am     Reply with quote

:=<font face="Courier New" size=-1>:=Can you please write me a code for 16f877 which turns on a led connected to the first bit of portb?
:=
:=//Program flashes led on port b0
:=
:=#include <16F877.h>
:=
:=// Tell delay routines which crystal frequency (set to suit your crystal)
:=#use delay(clock=16000000)
:=
:=// See manual for these settings
:=#fuses HS,NOWDT,PUT,NOLVP
:=
:=void main()
:={
:=
:= output_b(0); // First clear all port b bits
:=
:= while(1)
:= {
:= output_bit(PIN_B0,1);
:= delay_ms(500);
:= output_bit(PIN_B0,0);
:= delay_ms(500);
:= }
:=}</font>

Thanks. It helped a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515474
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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