View previous topic :: View next topic |
Author |
Message |
seyyah Guest
|
how to start |
Posted: Sat Jun 21, 2003 1:25 pm |
|
|
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
|
Re: how to start |
Posted: Sat Jun 21, 2003 5:09 pm |
|
|
:=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 |
Posted: Sun Jun 22, 2003 10:09 am |
|
|
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
|
Re: how to start |
Posted: Sun Jun 22, 2003 5:45 pm |
|
|
<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 |
Posted: Mon Jun 23, 2003 11:21 am |
|
|
:=<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 |
|
|
|