17
Lab 7 – Serial RF Communication Start date: Week #10 Due date: Week #11 1

Lab 7 – Serial RF Communication

  • Upload
    vito

  • View
    52

  • Download
    1

Embed Size (px)

DESCRIPTION

Lab 7 – Serial RF Communication. Start date: Week #10 Due date: Week #11. Serial Communications. 2 types of serial ports on the HC12 Serial communication interface (SCI) = asynchronous Serial Peripheral Interface (SPI) = synchronous - PowerPoint PPT Presentation

Citation preview

Page 1: Lab 7 – Serial RF Communication

Lab 7 – Serial RF Communication

Start date: Week #10Due date: Week #11

1

Page 2: Lab 7 – Serial RF Communication

Serial Communications

2 types of serial ports on the HC12 Serial communication interface (SCI)

= asynchronous Serial Peripheral Interface (SPI) =

synchronous

Know which one you want to use (RF has no clock signal pin)

2

Page 3: Lab 7 – Serial RF Communication

SCI

Communication through port S SCI0 = PS0 (RxD), PS1 (TxD) SCI1 = PS2 (RxD), PS3 (TxD)

Can do parity (either even or odd)Supports 8 or 9 data bitsSC0 is in use – communication with terminal

3

Page 4: Lab 7 – Serial RF Communication

Registers

SC0CR1/SC1CR1 Mode Parity

SC0CR2/SC1CR2 Transmit and receive enables Interrupt enables

SC0SR1/SC1SR1 Flags for complete and errors

4

Page 5: Lab 7 – Serial RF Communication

Registers

SC0DRH/L / SC1DRH/L Register to send/receive data through

SCI We will be using 8 data bits, so only

low is required

5

Page 6: Lab 7 – Serial RF Communication

Modes to use

Please set to use 1 start, 8 data, 1 stop No parity 9600 baud

Warning SC0 is already in use – this is what you use to communicate with the terminal

6

Page 7: Lab 7 – Serial RF Communication

RF module

The RF module sends and receives in 2 directions From board to RF, from RF to board The RxD and TxD lines are in reference to the

RF, ie send and receive over RF These will seem backwards from board

For RF modules with bent pins – just stick them upright into the boardWarning: sometimes the power light comes on when TxD or RxD is high – you still need to hook up the power or it will not work

7

Page 8: Lab 7 – Serial RF Communication

Sending Messages

Special Characters in use SOH – start of header

ASCII $01 STX – start of text

ASCII $02 ETX – end of text

ASCII $03 EOT – end of transmission

ASCII $04

8

Page 9: Lab 7 – Serial RF Communication

Sending Messages

Special Characters The base station prints the characters

as text because it is easier to read When you are printing you will see

them as special characters (^x)

9

Page 10: Lab 7 – Serial RF Communication

Message Passing

Base station sends out message to a groupThat group stores/prints the message and replies The base station stores/prints the message and repliesThe group stores/prints the message

10

Page 11: Lab 7 – Serial RF Communication

Message Format – Base Station

Base Station 1st send Message SOH GroupXX STX Message ETX EOT

11

Page 12: Lab 7 – Serial RF Communication

Message Format - groupXX

Group Reply STX Some message less than 20 chars ETX EOT

12

Page 13: Lab 7 – Serial RF Communication

Message Format – Base Station

Base Station Reply to group SOH GroupXX STX Some other message ETX EOT

13

Page 14: Lab 7 – Serial RF Communication

Summary of message passing

14

Page 15: Lab 7 – Serial RF Communication

General Notes / Hints

Please put a short delay between when you finish receiving and when you start sendingWe will wait for 1 second for a reply from each group Be aware that you may not receive anything for

that time it can be much longer than that before you

receive a message for your own group

Please do not send in other people’s time The RF modules cannot determine which is the

correct signal and the messages will get messed

15

Page 16: Lab 7 – Serial RF Communication

Testing

The base station will stay on for the whole week before the lab is due – front row Sending and receiving messages will be printed

on the screen

The TA’s will transmit as the last group (group 7) This is to check that the BS is actually

transmitting If you don’t see the TA group message, the

base station may not actually be transmitting We will try to check on it, but if there is a

problem, please email us

16

Page 17: Lab 7 – Serial RF Communication

Academic Misconduct

Reports and demos are submitted as a group, but it is a SINGLE group effortYou may talk with other groups but sharing code or reports is NOT ALLOWEDCopying code/reports from previous years is also NOT ALLOWEDIf we find copying we are REQUIRED to report it

17