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