USBDemo, something to learn USB a little bit


Closed Thread
Results 1 to 40 of 279

Hybrid View

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


    Did you find this post helpful? Yes | No

    Talking

    So, if mister_e gets a call in the middle of the night from a screamin' female who he doesn't know, this thread is most definetly the reason why.
    No problem then, my phone number is not hidden anyway... But, LOL, maybe she will have to repeat few times and be patient when i will try to reply to her... yeah my english writing is bad... imagine how bad i talk
    Steve

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

  2. #2
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Smile

    mister_ed, you are my idol

  3. #3
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Hi Steve,

    I'm revisting USB again and using parts of the demo as a bit of a refresher

    Im writing a program where I want to send half a dozen NMEA strings (of varrying string length) which are stored in their own array, to the pc running hyperterminal.

    I can send them successfully via USB using 6 separate DoUSBOut subroutines (without the SendUSB macro array code) but I want to trim my code down and use one (1) DoUSBOut routine to do the lot.

    ->>> I kinda have it working but the received data into hyperterminal appear as though some strings aren't received or are being over written or something.

    I've modified the SendUSB macro array so that the USBBufferOut should just keep filling up according to my USBBufferCount (array size) and suspect this is the problem but I'm rusty on ASM. Perhaps the USBBufferOut needs to be "erased" after each visit to DoUSBOut? How would I do that?

    I'm going blind looking at this code and wonder if you could see any traps I may have fallen into...

    Code:
    USBBufferCount     Var Byte        '
    USBBufferOut        Var Byte[50]  ' store outgoing USB data ...... this value originally [8]
    
    GPZDA VAR BYTE[28]
    GPGLL VAR BYTE[41]
    GPGGA VAR BYTE[49]
    GPVTG VAR BYTE[27]
    
    '...... arrays get filled up here.........
    '...... other code........
    
    asm 
    SendUSB macro array
        ;   Use to Copy an specific array to USBBufferOut AND send it
        ;   to USB bus
        variable i=0
        
        ;while i<8                           ' ...............original line here........
        
        while i<_USBBufferCount
            MOVE?BB (array+i),(_USBBufferOut+i)
    i+=1
        endw
        
        L?CALL _DoUSBOut
        endm
    endasm
    
    
    USBBufferCount = 28
    @   SendUSB _GPZDA
     
    USBBufferCount = 41
    @   SendUSB _GPGLL
               
    USBBufferCount = 49
    @   SendUSB _GPGGA
    
    USBBufferCount = 27
    @   SendUSB _GPVTG 
    
    
    DoUSBOut:
        '
        '   Send data to the USB bus & Wait for USB interface to attach                         
        '   ===========================================================
        T1CON.0 = 0                                     ' TURN OFF TIMER 
        
        WaitPC:                                         '
          USBService                                      ' keep connection alive
          USBOut 3, USBBufferOut, USBBufferCount, Waitpc  ' if bus available, transmit data                                  
        
        T1CON.0 = 1                                     ' Re-Enable TMR0 interrupt  
        return
    Last edited by Squibcakes; - 17th October 2007 at 07:30. Reason: Other thoughts....

  4. #4


    Did you find this post helpful? Yes | No

    Default Where did EasyHID go?

    Hi.. i canīt find EasyHid at mecanique webpage, is it gone? how do you get it now? did it became part of some package?

    Thanks

  5. #5
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Josuetas View Post
    Hi.. i canīt find EasyHid at mecanique webpage, is it gone? how do you get it now? did it became part of some package?

    Thanks
    Open MicrocodeStudio 3.0.0.5, in View menu, choose EasyHID USB Wizard

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. How to receive stream of bytes using PIC USART
    By unifoxz in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 20th June 2009, 10:38
  3. Replies: 9
    Last Post: - 31st July 2008, 08:56
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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