I am starting to build a data link between a 8051 or/and AVR micro controller and the PC through the serial port. I am using USB to SERIAL cables to provide a serial PORT to my LAPTOP.
I'll start with the 8051 (89S52 micro controller)
I'll be using Visual Basic's MSCOMM control to control the communication.
I have all the components ready to be assembled, but before i start i have a little question: Do i have to stick with the 9600 Baud rate?
I am using a 24Mhz crystal, and the baud rate is hence 375000 from the micro controller side. In Visual basic, do i simply enter 375000 in the baud rate field? Or are there certain values that i have to stick to?
Bear in mind that USB/Serial converters are normally very slow devices, because USB is a packeted system, and serial a byte system. Sending single bytes drops USB 1.1 down to about 9600 baud maximum. So while your serial conection speeds may be much higher than that, the actual throughput may be slow.
Thanks, In think i'll start with a gentle 1200 baud rate and using a MAX232 IC, then i'll start speeding up the process and also try to use cheaper buffer ICs (to replace the MAX 232)
Unless you are doing this as a learning experience I would hunt for an existing USB solution.
You may want to look in to the USB bitwacker project. It allows BASIC programs on the PC to manipulate the IO on a PIC. It is a single chip solution and you can build it yourself for next to zip or buy a kit from sparkfun for about $20.
The PC interface is written in liberty basic but it could easily be ported to VB. The BASIC interface uses virtual serial ports. You do not have to mess with the USB interface directly. It runs at USB speed regardless of baud rate settings.
It may be that the uC code provided will do what you need. If not you can modify or replace it, free C18 compiler. You do not need a PIC programmer. The firmware is programed via a boot loader. Recompiling the code with a different linker script will allow you to program it with a ICD2 or PICkit.