The Shop > Electronics & IC Programing
EasyPIC-6 Development Board by MikroElectronica - Take"2"
j45on:
Thanks Chris
that works a treat it certainly helps simplify things a bit :beer:
I now have a flashing letter J made from led's on my board :ddb:
raynerd:
Have you tried using variables yet?
--- Code: ---int count = 0;
while (1)
{
count = count + 1 // adds 1 to the variable count
if (count >= 500) // CHANGE the number Count is counting to!
{
count = 0; // when it does get to this number it`ll go back to zero
PORTC = ~PORTC; // ...and flip PORTC either on or off.
}
}
--- End code ---
See if that works - again, not got my EasyPIC board with me! I`m sure "~" flips the value from 1 to 0 or vice versa.
EDIT - by the way, the whole point of that is that your getting a delay using a variable and counting. Suprisingly useful!
EDIT 2 - have you used inputs yet?
j45on:
No I have not tried any of that yet I have only fiddled with the examples so far and the last bit of code you posted. :thumbup:
I was hoping to have the book I ordered this weekend gone but I ordered the wrong one :doh:
And I have been reading a book on C but it's aimed at computer programming and not microcontrolers.
There seams to be a lack of really basic beginners tutorials on the net for stuff like this
kwackers:
Books on assembler aren't really a dead loss since they'll allow you to get a feel for the hardware.
The most complex thing with PIC's is the hardware. Each pin on a PIC is multifunction, it may have an analog to digital converter, RS232, CAN, USB, SPI or a whole host of functionality as well as its ability to operate as a standard digital input or output.
Each of these requires that the mode the pin is operating in can be setup, and each mode requires registers set up to tell it how to behave.
That's why the examples can be useful to base your stuff on, find one that uses similar hardware to you and simply modify the code inside main after the hardware has been set.
Once you get the hang of the hardware then the programming is just standard C - it doesn't need to be PIC specific (although Mikro C does have some of it's own 'extensions' along with appropriate libraries for the hardware.
What all this means is you can use the assembler book to try and understand the hardware, but any C programming tutorial to understand the C language.
Bluechip:
I got 'Designing Embedded Systems with PIC uControllers' from Amazon some weeks ago. Lots of example code for asm. and C18.
Starts pretty much from Sq. 1
Found it very helpful.
About £22 ish
Nice thick heavy book. ( Also good for the flattening the spine of books on the scanner .... :thumbup: )
Would like to find one with some stuff for Hi-Tech C, but not much luck.
C18 don't do 16Fxx chips. Which is a bit of a bummer, 'cos I was given quite a number ... :scratch:
Dave BC
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version