Well... after trying extended characters from the JALedit terminal and they worked, I knew it had to be in the Visual Studio code. Turns out by default when sending characters only 7 bits are sent. For anyone interested, I added
comPort.Encoding = System.Text.Encoding.Default to my Visual Basic code serial port setup to get it to send all 8 bits. All is working now... Now on to my next problem of sending 2 or more port states to the microcontroller (in a packet???) Any examples out there? On Jun 27, 9:21 pm, John in WI <[email protected]> wrote: > Matt- > Thanks! that helped a lot. I found a function that converts decimal to > ascii. It seems to work great, but when I send anything over 127, my > most significant bit is lost and my port won't make that last output > go high (in my case, c7) > maybe in my JAL code? Below is my main loop- just a modified the loop > on the Jallib sample 18f14K50_usb_serial. > > Visual studio seems to be doing it's job converting correctly... I'm > sending a ÿ when I convert a 255. The echoed characters are correct > up to 127 as well... beyond that I only get ? marks back. > > By the way, Visual Studio Express is free, and I've been able to do > some remarkable things with it. I mostly use the Visual basic version. > > My JAL code:(all the setup stuff, etc not included, except my portc > setup) > > portc_direction = all_output > > -- main loop > forever loop > -- poll the usb ISR function on a regular base, in order to > -- serve the USB requests > usb_serial_flush() > -- check if USB device has been configured by the HOST > if ( usb_cdc_line_status() != 0x00 ) then > if !has_shown_welcome_msg then > has_shown_welcome_msg = true > print_string( usb_serial_data, str_welcome ) > > end if > else > has_shown_welcome_msg = false > end if > > -- check for input character > if usb_serial_read( ch ) then > > portc=ch > > -- echo input character > usb_serial_data = (ch ) > > end if > > end loop > > On Jun 27, 5:51 pm, mattschinkel <[email protected]> wrote: > > > Search Google for "ASCII CHART". If you want numbers, you may need to > > convert your ASCII that you are receiving into decimal numbers and the > > other way around to send data back to the PIC. It is the software that > > makes it show on your PC as an ASCII character. I'm sure Visual Studio > > has a function for this conversion. > > > I have some serial port software that I wrote in Autoit that you may > > modify if you like. It is able to send decimal numbers to the PIC. I > > prefer this windows language because it is free. > > > Matt. > > > On Jun 27, 3:14 pm, John in WI <[email protected]> wrote: > > > > Is there a simple example for me to study on receiving bytes (not just > > > characters) via usb_serial_read???? > > > I'm using a 18f14k50- I can send & receive ascii characters, but I'd > > > rather just send a raw decimal form 0-255. When I send a raw number > > > (something with no quotation marks), let's say 127, only the 1 seems > > > to be stored in my usb_serial_read variable. > > > > My goal is to simply assign the ports on my 18f14k50 with whatever > > > byte I am sending via the usb_serial_read ... for now, I would settle > > > for just 1 port. > > > > I'm using Visual Studio on the computer end. > > > > Later, I want to do all 3 ports. Would I have to set up some sort of > > > packet to write decimal form byte values to all 3 ports? Any examples > > > of this out there? -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
