1 / 11

Microchip PIC Networks

Microchip PIC Networks. Amrit Bandy, Ben Funk Neil Goldsman. 2-Node Wired Set-up. PICs hooked up with wire connections PICs are small micro-controllers made by Microchip. Tx. Tx. μ P1. μ P2. Rx. Rx. µP: 16F88 by Microchip Features Built in A/D Conversion Module

fayed
Télécharger la présentation

Microchip PIC Networks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Microchip PIC Networks Amrit Bandy, Ben Funk Neil Goldsman

  2. 2-Node Wired Set-up • PICs hooked up with wire connections • PICs are small micro-controllers made by Microchip Tx Tx μP1 μP2 Rx Rx • µP: 16F88 by Microchip • Features • Built in A/D Conversion Module • Universal Asynchronous Transmit and Receive using Tx and Rx ports. (Serial communication controlled by programmer)

  3. Step 1: Establish Network via Clock Synchronization • Node Clock Definition: • Built-in 8-bit timer, counts up from 0 to 255, sets off an interrupt upon overflow. Prescalar of up to 256 available. • Node Clock (our timer) updates every time the interrupt occurs (part of code) • Synchronization of Clocks • Node A transmits its NodeClock to Node B while Node B receives it and updates its own NodeClock

  4. Timer Synchronization Algorithm Node A: • Setup Tx Port for RS232 Transmission and Rx port for RS232 Reception using Universal Asynchronous Reception and Transmission • Check for hardware switch-If “on” goto 5 else 3 • Transmit packet comprising AB in hex (frame sync byte to intelligently qualify data packet to follow), followed by the NodeClock • Goto 2 (only one or two iterations needed) • Transmit NodeClock value to Real Terminal on Computer and print value on screen. Step 5 is to test the node synchronization

  5. Timer Synchronization Algorithm Node B: • Setup Tx Port for RS232 Transmission and Rx port for RS232 Reception using Universal Asynchronous Reception and Transmission • Check for hardware switch-If “on” goto 7 else 3 • Receive first byte, if it is not equal to ABh repeat 3. • Clear and start NodeClock • Receive second byte (clock of node A), add to NodeClock to update NodeClock • Goto 2 • Transmit NodeClock value to Real Terminal on Computer and print value on screen. Step 7 is to test the node synchronization

  6. Step 2: Data Transmission After Synchronization • Voltages represent sensor node reading • Each node compares its own voltage with voltage received from the other node and an LED is lit on the node with the highest voltage • Procedure: • Assign PIC_id for each node and COMM_id for the node that is transmitting • Establish Network by synchronizing clocks • Transmission and Reception are carried out in equal slots (TDMA) • Transmitting slot includes reading A/D data and transmitting packet • Reception slot includes receiving packet, comparing voltages of all the nodes, and lighting LED • Update COMM_id to give next node a chance to transmit data

  7. Data Transmission Algorithm • Synchronize timer to node A • If PIC_id=COMM_id goto 3 (transmit) else 7 (receive) • Read A/D voltage(10 significant bits) into two 8-bit registers, right justified • Transmit packet: ABh, NodeClock, highbyte(data), lowbyte(data) • Update COMM_id to allow next node to transmit • Wait for slot to expire, goto 2 • Receive first byte, if it is not equal to ABh goto 7. • Clear and start timer • Receive second byte, add to NodeClock to update NodeClock • Receive highbyte (data) followed by lowbyte (data), and store information for the node which is transmitting • Compare voltages for all nodes, light LED if self is highest • Update COMM_id, Wait for slot to expire, goto 2

  8. Step 3: Extend Wired Setup to 3 nodes • Issue: 16F88 has only one Rx port! • Solution: Use AND gate to choose correct line, since the transmitting line is high while receiving. Tx Rx Tx Rx Tx Rx µP1 µP2 µP3

  9. 3-Node Wired Setup Using AND Gates • Why AND gates? • Transmitting line is high while receiving • Truth Table shows that the AND gate reproduces the Tx signal

  10. Step 4: Remove the Wires – Employ Transceivers • Transceiver used: TR-916-SC-P by Linx Technologies • TXEN pin to enable Transmit • RXEN pin to enable Receive • Can only transmit or receive at a time • Algorithm remains the same except • Allow enough time for transceiver to start-up • Enable TXEN, disable RXEN for transmit • Enable RXEN, disable TXEN for receive

  11. Testing Steps 1-4 • Setup: 3 PIC 16F88 microcontrollers connected to potentiometers. Nodes B&C synchronize themselves to Node A, transmit their own voltages , receive that of the others, compare and indicate who is the highest using an LED. • Baud Rate: 19.2Kbps • Transmit/Receive Slots : 200ms with 20MHz clock • Results: Both the wired and the wireless models work for 3 nodes.

More Related