Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

USB to Serial port and DC motor

Status
Not open for further replies.

jacks

New Member
Good Friends

I want to control a DC Motor from using packets. I am thinking I will generate packets using PC. My thinking was send 46bits from the computer to a serial port and then the packet gets shifted to serial to parallel shift registers( The 74HCT164 registers will be cascaded to meet the 46 bit requirement). Once the all data is on the registers I output data to the PIC16F628 to control the motor (Speed, Stop, directional).

You may ask why need all 46bits? Good question, well 14 bits is going to be for preamble, 8 bits is going to be for address, 8 bits for Direction and speed(5 bits for speed) , 8 bits for error detection and lastly a bit for start transmitt and a bit for terminating.

Any ideas? I just got myself a USB to serial cable for sending data. Thanks

Jacks
 
Why use shift registers? The PIC16F628 can read that serial input, and it's a whole lot easier than trying to do it with raw logic chips. Look up "software uart" on the PIC site.
 
Duffy

Thanks for the reply. I too thought like that but I guess its for demostrating that the serial data consists of various bit of data.

Jacks
 
Can you at least use the PIC to control the timing? The USB to serial is going to give you asychronous serial data, the shift registers want synch.

It would be simpler just to use the PIC to read the serial data, then output it to the five 8-bit shift registers and light LED's or whatever. This will also save you from having to do a bunch of parallel reads.
 
Duffy

I guess I did not think about the synchronous data. I will do what you say and see whether I will be able to . Thanks

Jacks
 
Packets to PIC

Good friends

I am now trying to control the DC Motor driven by H-bridge with 4 bytes which will come from the serial port. How do I write this in assembly for the PIC16F628? Thanks

Jacks
 
If you are using a USB to SERIAL adapter at your PC, and plugging the RS232 connection on your test circuit, I'd make sure you have hardware handshaking enabled on your test circuit and in the virtual com port that gets assigned to the adapter.. TX-RX-CTS-RTS. Sure makes things more robust. I've seen more than one occasion where the serial com is flakey when using these adapters if this is not enabled.
 
Hi Shingadaddy

I will look into that. If I see I have problems I will use the PC serial port rather than my USB on my laptop. It is complicated implementing this, though I am reading a tutorial from Nigel's site.

Jacks
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top