CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

USB data type error

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ffotsch



Joined: 14 Sep 2008
Posts: 8

View user's profile Send private message

USB data type error
PostPosted: Fri Nov 14, 2008 11:31 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Nov 14, 2008 1:05 pm     Reply with quote

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
PostPosted: Fri Nov 14, 2008 5:32 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Nov 14, 2008 9:20 pm     Reply with quote

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







PostPosted: Sat Nov 15, 2008 3:17 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group