View previous topic :: View next topic |
Author |
Message |
ffotsch
Joined: 14 Sep 2008 Posts: 8
|
USB data type error |
Posted: Fri Nov 14, 2008 11:31 am |
|
|
I have a USB serial connection established between an 18f2553 and a PC. I am using VB.net to receive bytes from the PIC. I am using the USB to UART emulator. The problem is I can't send a value greater 127 from the PIC. I have tried changing the data type in CCS C to CHAR and unsigned int8. When I look at the data stream in HyperTerminal, I get nothing above 127. I am using the USB_CDC_PUTC () command to output my bytes from the PIC. Any suggestions will be appreciated. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Nov 14, 2008 1:05 pm |
|
|
To m opinion, there isn't a particular data type implied with USB. I'm sending and receiving binary data through virtual COM port and CCS USB drivers without any problem and did the same with other processors and hardware USB adapters (FTDI chip).
It may be a problem of Hyperterminal settings. By default, characters above 0x7f aren't printable, I think. If you use the receive text option to write the data to a file, you can see them anyway. But Hyperterminal has other terminal emulations that utilize 8-Bit data. With binary data transfer protocols as X- or Z-Modem, Hyperterminal is always using 8-Bit data.
However, it's not clear from your post, what you want to achieve with 8-Bit data in Hyperterminal. |
|
|
Guest
|
USB data type problem |
Posted: Fri Nov 14, 2008 5:32 pm |
|
|
Thanks for the feedback. I am trying to send one byte via USB. My goal is to transfer EEPROM data collected from the A/D. I am using pointers to get at the high and low bytes of a long. I want to transfer the data to a VB.net app. Everything is fine accepting this issue. I am using HyperTerminal only to verify what I observe in VB.net. The two agree. Only 7bits getting through 0x7F. I'm thinking it is using the MSB as a sign not a value. I am suspicious of the PIC side of things. I have tried the type unsigned int8 and char. I thought both of those used the MSB as a value not a sign. Anyway, I really appreciate your thoughts. What do you think? |
|
|
ffotsch
Joined: 14 Sep 2008 Posts: 8
|
|
Posted: Fri Nov 14, 2008 9:20 pm |
|
|
FvM you were correct. My HyperTerminal was in V52 and when I switched to ANSI I saw all 256 chr. I also observed all in another program. So the problem is in VB.net. It must be using the MSB as a sign. Thanks. |
|
|
Ttelmah Guest
|
|
Posted: Sat Nov 15, 2008 3:17 am |
|
|
That is 'down' to what data type you tell VB.net to read the bytes with, and how you are opening the port. If you are using a system.IO.Ports device, and read the data into a 'byte' data type, all 256 values are happily available.
Best Wishes |
|
|
|