PDA

View Full Version : Idea of master/slave serial comm.



sirvo
- 4th December 2007, 11:24
Hello ... I'm about to work on a project that needs an interface by software. I'll use PIC16F676 and before I start doing things, I was trying to get the idea of how to make PIC and PC send information to each other at the same time..

So, in a basic system, let's say a got a PWM in a Pin1, a Sensor in Pin2 and Serial Comm. in Pin3, Pin4.

I would like to send the value of the AD of the Sensor to the PC continuously and also receive from PC values of the PWM that will be applied in Pin1. But, without HPWM, how can this be possible? I'm asking that because the PWM Pin is connected to a CC motor and it must be ON all the time.

So, and the question are.

Is it possible to use a VAR in PWM command?
How would be the SERIN and SEROUT commands (because PIC needs to say and listen all the time)

Please, I'm not asking the codes, only some idea... (but if there is a code, it would be great, :) )...

Thanks in advance..

Sylvio

Ioannis
- 5th December 2007, 07:57
1. I would not do it without USART or HPWM.

2. When you choose an appropriate PIC chip, consider using Interrupts. Have a look at Darrel's Instant Interrupt (here or at his site www.pbpgroup.com)

Ioannis

T.Jackson
- 5th December 2007, 12:51
But, without HPWM, how can this be possible? I'm asking that because the PWM Pin is connected to a CC motor and it must be ON all the time.


If things are happening fast enough it's possible without HPWM or USART. Certainly not ideal though nowadays, but if you can do it without them, you lend the project to be able to utilize some of the smaller & cheaper controllers that don't have HPWM & USART available.

How do you think the Z80 & 8086 controllers managed to do stuff like this? (All software-based)

sirvo
- 6th December 2007, 02:25
I've just bought a brand new 16f877.

I used HPWM and Usart and everything is working excelent.. and also used visual basic to control de motor and so..

Thanks again..

Regards.

Ioannis
- 6th December 2007, 08:36
How do you think the Z80 & 8086 controllers managed to do stuff like this? (All software-based)

Didn't they rely on external chips for USARTS, PIO, RTC etc?

I still remember the 8251 (UART), 8253 (Counter-Timer) and 8255 (PIO) chips! Good old times!

Ioannis