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.

Multitasking

Status
Not open for further replies.
:) you are correct, I was jumping to this PIC Programming cold water without bringing any swimming specs or even wearing the swimming shorts!!

By making one of pin Low, and the other side (anode) is VDD, it means there is potential difference and the current flows. And making the pin low is by setting the Tris to 0?? or LAT to 0?? Which is which, what are these basic meanings?
If a bit is 1 in a TRIS register it is an input
If a bit is 0 in a TRIS register it is an output
The value or state of output pins are set by the LAT register

Example
TRISB=0b11110000 // 0xF0
LATB =0b10101010 // 0xAA

on the pic pins
bit 0 will be 0
bit 1 will be 1
bit 2 will be 0
bit 3 will be 1
bits 4-7 are inputs and do not have any voltage on them. To the outside world the are tri-stated.

You have done well with the info provided here but we need to get you to start reading manuals, tutorials, and datasheets. That is unless this is your one and only project.
 
of course this is not my only project, there are multiple tricks to do, like this afternoon I modified the source code, tommorow I will post and now I can understand a little bit about the time slot thingy. I made the throttle flashing rate different to steering, so I can program both of them conviniently.

Tommorow I will post something. Thanks 3v0 for ur clear explanation!!!
 
Code:
iPulse2 = GetPulse2();
		
if (iPulse2 < 7000)                 /*If iPulse2 is less than 1.4ms*/
{
	vForward();
	tState = 1;
}
	
if (iPulse2 > 8000 && tState == 1)                 /*If iPulse2 is more than 1.6ms*/
{
	vBrake();
	tState = 2;
}

from this code I get the correct braking signal, but I don't have any idea how to make my microcontroller remember how to differentiate Brake and Reverse.

In order:
1. Standby
2. Forward > Brake, after this, could be Forward OR Reverse.

1. Standby
2. Brake > Reverse, after this could be Forward OR Reverse.

The KEY is before Reverse, Brake must came into play while Forward is open for any time.

What should I do? Thanks!
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top