1 / 19

Les 6 - onderwerpen

Les 6 - onderwerpen. seriele interface (UART - USB - VCP) IR De datum om je eindopdracht te laten zien is woensdag 8 november, 14:50 .. 17:50. (evt vanaf 13:10) (volgende week mag ook...)   Inschrijven in Osiris is verplicht  . PIC - USART.

sibyl
Télécharger la présentation

Les 6 - onderwerpen

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. Les 6 - onderwerpen • seriele interface (UART - USB - VCP) • IR De datum om je eindopdracht te laten zien is woensdag 8 november, 14:50 .. 17:50. (evt vanaf 13:10) (volgende week mag ook...)   Inschrijven in Osiris is verplicht   Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  2. Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  3. PIC - USART USART = Universal Synchronous / Asynchronous Receiver + Transmitter • wij gebruiken asynchroon • PIC UART pins zijn verbonden met een FT232R USB-to-asynchronous converter • Op de PC wordt een (virtuele) seriele poort aangemaakt (XP heeft al een driver) control panel  system  hardware  device manager  ports • evt driver van www.ftdichip.com gebruiken • op de PC gebruik je een terminal, bv HyperTerminal (hypertrm, 19k2, no parity, no flow control, hu: com3) Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  4. PIC - USART Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  5. Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  6. BRGH = 0 BRGH = 1 Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  7. - 0 1 0 - 1 R - Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  8. 1 0 - 1 0 R R - Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  9. PIC – USART - init make TxD (RC6) output, RxD (RC7) input SPBRG: 19k2 value for high speed TXSTA: 8 bit, enable, asynch, high speed RCSTA: enable, 8 bit, continuous, no ADDEN Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  10. PIC – USART - send • wacht tot TSR bit aangeeft dat TSR empty is • copy het te verzenden byte naar TXREG • (wacht tot TSR bit aangeeft dat TSR empty is) Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  11. PIC – USART - receive • als OERR bit gezet is: • clear CREN • wacht een paar instructies • set CREN • als PIR1 : TXIF op 0 gezet is: • lees RCREG, dit is het ontvangen byte (anders is er nog niets ontvangen) Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  12. power van de 2e USB poort Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  13. PIC – USART – demo code subroutines UART_INIT : call to inistialise the UART for 19k2 UART_CHAR_SEND : sends the char in W UART_CHAR_RECEIVE : checks the UART for a received char, C flag set when a char is received (char in W), C flag is cleared when no char is received UART_CLRF_SEND : sends the CR LF sequence Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  14. PIC – USART – demo code main MAIN CALL UART_INIT MOVLW 'H' CALL UART_CHAR_SEND MOVLW 'i' CALL UART_CHAR_SEND CALL UART_CLRF_SEND MAIN_LOOP CALL UART_CHAR_RECEIVE SKPC GOTO MAIN_LOOP MOVWF Char MOVLW '"' CALL UART_CHAR_SEND MOVFW Char CALL UART_CHAR_SEND MOVLW '"' CALL UART_CHAR_SEND CALL UART_CLRF_SEND GOTO MAIN_LOOP Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  15. De IR ontvanger (1) • (alleen) gevoelig voor een ~ 36 kHz signaal. • Dat signaal mag niet continu zijn Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  16. De IR ontvanger (2) (alleen) gevoelig voor een 36 kHz signaal. Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  17. De IR ontvanger (3) Aanbevolen: puls >= 400uS, periode =< 0.4 Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  18. De IR ontvanger (4) Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

  19. Eenvoudig IR zenden / ontvangen • 36 kHz  28 us per puls  5 * 28 instructies per fase (hoog of laag) • 400 us / 28 us  minimaal 14 pulsen, neem bv 30 pulsen • Onmiddelijk daarna de IR ingang lezen (laag == signaal gedetecteerd) • Pauze! • herhaal Hogeschool Utrecht / Institute for Computer, Communication and Media Technology

More Related