need help hserin/hserout cmucam4


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: need help hserin/hserout cmucam4

    Many different way to skin a cat, but sometime, Hserin timeout feature can be handy.

    HSERIN 500, main,[WAIT("ACK\r"), SKIP 1, tc_mx, tc_my,SKIP 4, p0, c0, SKIP 2]

    OR something like this will also work
    Packet VAR BYTE [11]
    tc_mx VAR Packet[1]
    tc_my VAR Packet[2]
    p0 VAR Packet[7]
    c0 VAR Packet[8]

    HSERIN 500, main,[WAIT("ACK\r"), STR Packet\11]

    may looks like a mess of variable, BUT...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Dec 2012
    Posts
    2

    Default Re: need help hserin/hserout cmucam4

    so the code will look like:

    Dim tc_mx As Byte
    Dim tc_my As Byte
    Dim tc_x1 As Byte
    Dim tc_y1 As Byte
    Dim tc_x2 As Byte
    Dim tc_y2 As Byte
    Dim tc_p0 As Byte
    Dim tc_c0 As Byte
    main:
    HSerOut ["TC",13]
    HSerIn 500, main,[WAIT("ACK\r"), SKIP 1, tc_mx, tc_my, tc_x1, tc_y1, tc_x2, tc_y2, tc_p0, tc_c0, SKIP 2]
    will it repeat main: if ACK\r doesnt appear?.. like when it recieves NCK\r

    and how about #1?
    if i enter like HSEROUT ["AG 0",13] the cmucam4 will return either ACK\r or NCK\r
    Dim B1 As Byte
    test_ag:
    HSerOut ["ag 0",13]
    HSerIn [B1]
    'if the data received is NCK\r it will repeat test_ag:
    'while if its ACK\r it will move to the next part of the code

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: need help hserin/hserout cmucam4

    How about trying it and see what happen. Those are guideline, really more than enough to begin.

    Serial signal sniffer comes handy in those situations.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Help understanding HSERIN/HSEROUT
    By jmbanales21485 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 9th March 2021, 08:47
  2. Hserout/Hserin max.speed
    By Mugelpower in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th February 2008, 09:13
  3. Rs485 Using Hserin/hserout
    By koossa in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 31st January 2008, 10:42
  4. Hserin/Hserout question
    By Philley in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th May 2007, 14:17
  5. Hserin/hserout ?
    By Scott in forum General
    Replies: 6
    Last Post: - 28th April 2005, 00:46

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts