HomeTOOLSEXAMPLESEXPLORE EMBEDDEDE CSERVICESECU SAMPLESRegistration
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
4.ASC0-GPT1-MACROS
5.ASC0-FIFO-PEC
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
19. BITFIELDS
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.
39. CRC CHECK
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.
45. CANBUS C CODE EXAMPLE.
5.ASC0-FIFO-PEC

This article explains how you can save the received from the ASC0 bytes in the FIFO buffer and how you can export them back  to the  screen of the RealTerm program using the Peripheral Event Controller (PEC).

FIFO buffer
means first in first out buffer.
RealTerm is a serial terminal program where we can work with hexadecimal values or ASCII characters. Take
RealTerm  . It is like HyperTerminal but Hyper Terminal works only with ASCII characters. Configure RealTerm as at the pictures here.

Lets go to make a  RECEIVE FIFO  using DAVE. Your travel:
//start DAVE >>ASC0>FIFO>(Enable the receive FIFO (RXFEN), Interrupt triger level (RXFITL) //select Triger level=3).

Triger level=3 means that when the fourth byte comes to the FIFO we have an interrupt and the first saved byte comes out. So the filling level of the FIFO remains three. In the same way when at the FIFO comes the fifth byte then the second saved byte comes out etc. 
The FIFO is a 8 stage buffer , you can't 'catch' it by software, but you can  control it only.
At this example we use and a macro in the file INT.C line 209. It sends back the filling level of the FIFO.

The example program.

Open it by DAVE and watch the selections. Observe the interrupt levels. When a byte is received then we have an interrupt and the PEC  (when we have reached the filling level of the FIFO) exports it back to the transmit buffer and at the end to the screen of your computer.
Build it, burn it in the microcontroller and reset and run it.
As an example type  the numbers 1  2  and 3 on the screen of RealTerm. Then you will see on the screen of RealTerm the number 03. It is the filling level of the FIFO. Nunbers 1,2,3 are now in the FIFO but not on your screen yet!.
Hit '4'. Then you will see on the screen the hexadecimal 0x31 (the nummber '1') who comes out from the FIFO first (and first in)  and 03.
Hit '4'. Then you will see the hexadecimal 0x32 (the number '2').
Hit '4'...    0x33
Hit '4'...    0x34     see the sreen
If you hit other keys of your keyboard then you will see their hex code on the screen.

Exercise 1: Change the filling level of the FIFO using DAVE (for example Triger level=5) and repeat.

Exercise 2:
Destination Pointer for PEC is now &ASCO_TBUF. Change it to parallel port P1L.
Help: Modify line 220 in the file INT.C


 

Home|TOOLS|EXAMPLES|EXPLORE EMBEDDEDE C|SERVICES|ECU SAMPLES|Registration