UPC EETAC Bachelor's Degree in Telecommunications Systems and in Network Engineering EEL

Chapter 3 problems

     - D3.25 -

Serial receiver

Problems

D3.24

D3.26


FSM, external interrupts INT0, INT1, state enumeration (plan X)

1. Specifications

Project is under development, in preparation. Implement a 4-bit Serial_receiver as the dual circuit of the 4-bit Serial_transmitter presented in P10.

Symbol

Fig 1. Symbol.

Features:

 

Symbol

Fig 2. Waveforms

 

2. Planning

A) Planning hardware

 

Symbol Fig. 3. Hardware circuit.

 


B) Planning software

 

Symbol

Fig. 4. Hardware-software diagram.

Draw the state diagram.

Symbol

Fig. 5. State diagram.

Represent the RAM variables required in this application.

Symbol Fig. 6. RAM variables.

Draw the main ideas of init_system(). Configure input and output pins. Consider as well interrupts configuration.

Symbol Fig. 7. TRIS, data direction registers configuration.

 

read_inputs() flowchart.

Symbol Fig. 8. Reading inputs. 

 

write_outputs() flowchart.

Symbol Fig. 9. Writing outputs.  

Infer how to organise the interrupt service routine ISR() to handle edge detections.

Symbol Fig. 10. ISR() function.  

Draw state_logic() truth table and flowchart.

Symbol Fig. 11. State logic flowchart is a behavioural interpretation of the truth table CC1. 

Draw output_logic() truth table and flowchart.

Symbol Fig. 12. Output logic flowchart is a behavioural interpretation of the truth table CC2. 

 

Organise a MPLABX - XC8 IDE project targetting a PIC18F4520 at location:

C:/CSD/P10/Serial_receiver/(files)

 

3. Development  - 4. Testing  interactively

A) Developing hardware

This is a file Serial_receiver.pdsprj containing the circuit represented in Fig. 13. 

Symbol

Fig. 13. Circuit running.

 


B) Developing software

The planning ideas in the previous section are translated to Serial_receiver.c source file.

 Run the microcontroller's IDE to develop and compile the C code to obtain executable files.


C) Step-by-step testing

Run the Proteus simulator. Do it in step by step mode while watching variables and placing break points, specially for following interrupt flags.

In this application we have two options for generating input stimulus:

(1) Generate a test waveform to drive input RX simulating transmitted frames.

(2) Include in the same project the Serial_transmitter to drive the receiver

Remember that development and testing must be carried out step by step, one feature at a time.

 
Fig. 14. Waveforms in Proteus

 

5. Report

 

6. Prototyping