Embedded C programming Tutorial , Keil C ide , microsoftware.gr
Keil CRC and CAN BUS codes.
1. Shift led left
2.It's time for DAVE! <7/6/13>
3.Capture/Compare unit 6
6.Analog converter
7.Memory manipulation routines
8. Recursion
9.Understanding interrupt priorities using CAPCOM2 module
10. POINTERS TO FUNCTION <4/7/13>,<4/28/13>
11.Memory models, memory types
12. The heap , part 1
13. The heap , part 2
14. The heap , part 3
15. Structure example
16. Nested structures, Array of structures.
17. Passing array of structures to function using pointers.<1/5/13>
18. Self Referential Structures
20. Linked list example
21. Circular linked list
22. Union example
23. Enumeration example
24. Watchdog timer example
25. Void pointer example <7/4/13>
26. The sieve of Eratosthenes
27. The stack
28. Union and bitfields as flags example. <6/23/13>
29. Look up table example. <8/11/13>
30. Seven segment display multiplexing -four digits with dot- example
31. LCD character display example - JHD162A
32. Hash table introduction example <8/27/14>
33. Array of Linked Lists example
34. Array of Linked lists-more functions included.
35. Hash table construction,searching and printing.
36. Fininte state machines- a first approach.
37. Finite state machines- two events example.
38. SPI port and an AT25128 serial eeprom hardware.
40. Definite Integral Calculator for Scientists, Engineers...
41 .Hamming distance of a CRC polynomial
42. Linux play starting.
43. Galois GF(2^4) Finite Field
44. Construct your own time triggered real time operating system.
2.It's time for DAVE! <7/6/13>

This article explains how DAVE works

You have to configure your microcontroller first! What?
Today, modern microcontrollers contain inside the chip a lot of Special Function Registers ,SFRs. The presense of these SFRs give the ability to the engineer to configure his microcontroller as he wants.
Watch some cases:
* The pins of a parallel port are programable. It means that you can do them to be input pins or out pins. How? Loading an SFR with the right word.
* Some pins of the chip are common pins to different modules. For example the UART and a parallel port use the same pins of the integrated circuit. You have to select who will use these pins ,programming an SFR.
To regulate the Baudrate of the UART or the CAN controller you have to program an SFR.
You can modify the clock frequency. You have to program an SFR.

But how you can program the right SFR with the right word?
You have to find the address of the SFR and to find and the right word that you will put in SFR.
A dirty job!
But don't worry. DAVE will do the dirty job for you! Easily, with some 'click'.
So, we will explain how DAVE works.

See DAVE basic keys.

Don't forget to load DAVE with the .dip file for xc164cm !

Now we will build the project 'shift led left- Dave' .
Create a folder 'shift led left-Dave' and follow:
// start Dave  >create a new project>xc164cm>create>project settings>// go to type and select  xc164cm-8F40 >compiler settings // select Keil > system clock >VCO output frequency 150...200 MHZ >fn=fosc/1, fpll=fvc0/5, fvco=fin*25, fcpu=fpll/1   .

As you can see the main frequency of the crystal of the clock of the development board is only 8 MHZ, now we have a multiplied clock frequency, it is 40 MHZ !

And you have to continue...

>>port // on in icon of modules of xc164cm >configure Port 1L > // set all pins out with initial value high. Remember! The leds emit light when the pins of the xc164cm are low. (o volts) > Functions // don't forget it! >IO_vInit

File >save >// give the name 'sfift led left-Dave' and save at the folder  ' shift led left- Dave' .

And the End: >>
generate code   take the DAVE project with no added C code

Next step: we will add C code to the project.    
take the DAVE project with added C code
Observe the areas where DAVE allows to add  C code! These areas are not affected by DAVE when we
re-configure the project by DAVE!!!

Exercise: Using the technique of the article 28, give names to each one of the 8 bits of the parallel port P1L register that are connected to the 8 leds, for example give names like LED0..LED7 and design your led ON and OFF patterns.Use Dave to configure P1L bits as outputs with initial state high (all led OFF). 

Led pattern example.