PDA

View Full Version : PBP projects for R/C models



Pages : 1 2 3 [4]

Kenjones1935
- 26th March 2011, 20:39
HPWM is a hardware command. It runs while PAUSE is pausing except (it appears) when it is the first "active" command in the code. Really. Truly. The only difference between those two snippets of code is the WHILE statement at the beginning of the one that works.

Note: These few lines of code precede the 'main:' label. All I am trying to do is to demonstrate that the wheel controls are working before experimenting with racing. Once the program counter gets past 'main:' both versions run identically.

Ken

ScaleRobotics
- 26th March 2011, 21:50
Yes, but how are you checking to see that hpwm is not working, sometimes. Are you really observing the signal itself, or just the reaction it is "supposed" to cause? You have the tools to look at the source .... why not use them?

Kenjones1935
- 26th March 2011, 23:54
I compile the code with the WHILE command. During the first three seconds after powering up the wheels steer and roll as expected. I then comment out the WHILE, recompile and program. For the first three seconds the car does nothing. The PAUSEs work but the HWPM commands do not.

After the initial three seconds both programs work identically.

Ken

ScaleRobotics
- 27th March 2011, 00:30
The PAUSEs work but the HWPM commands do not.


You really need to test the signal Ken. Without observing the signals, you really can't say HPWM doesn't work. How about getting your Pickit2 out and using the logic probe again?

Kenjones1935
- 28th March 2011, 02:30
Scalerobotics:

I used the oscilloscope you gave me way back when. You are correct. The PWM signals appear to be there from the get go, but the wheels neither rotated nor steered until the program counter got past 'main:'.

The pulse traces on the scope are stable and easily readable.

All my fault - nothing new there - just between us programmers. I thought I had set PORTC.0 low with a TRISC = %11110000 when in fact I had set it to be an output. This is the pin that drives the DPDT switch that selects between PIC control and radio receiver control. Once I activated the LOW portc.0 located just before the HPWM commands. Lo and behold!

Thank you for your patience and smarts.

Ken

Kenjones1935
- 11th April 2011, 00:58
One of you knowledgeable people please come to my aid.

I am studying the .ASM code which my PBP produces. My Microchip 16F887 Data Document DS41291F page 232 lists the Assembly Language commands for the 16F88x chips. There is no HPWM in that list. Yet my .asm code contains:

HPWM?CCC 001h, _Right, 032h

How does the Assembler know what to do with that string?

I figured it must be in one of the includes. I searched all the files in the PBP directory, the Mecanique directory and the Microchip directory for the string HPWM. No luck except in my .pbp code that I wrote and its resulting .asm.

This is not a show stopper, but I would like to know what I am missing.

On the very good news side, MIT's Lincoln Laboratory has an Educational Outreach initiative. They have picked up the idea of racing robocars. I am sure that they will take this to the next level - whatever that is. :)
Ken

mackrackit
- 14th April 2011, 12:38
HPWM?CCC 001h, _Right, 032h

How does the Assembler know what to do with that string?


In the PBP directory there is a file , pbppi14e.lib , that has the macros.

Kenjones1935
- 14th April 2011, 18:04
Thank you Mr/Ms Mackrackit

pdppi14e.lib catches all my questions (for example how does PAUSE work) except one. HPWM is nowhere to be found. I know it is a hardware feature (whatever that means). Somehow the assembler has to know how to translate it into .hex.

All in all, as I said, my robocar project is progressing. Anybody got any ideas what other kind of do it yourself robots might hook middle school students?

Ken

ScaleRobotics
- 15th April 2011, 04:49
It's in there ... about 1/4 the way through.


;************************************************* ***************
;* HPWM : Output a pulse width modulated wave in hardware *
;* *
;* Input : W = channel 1 - 5 *
;* : R1 = frequency *
;* : R4 = duty cycle *
;* Output : None *
;* *
;* Notes : *
;************************************************* ***************

Kenjones1935
- 15th April 2011, 14:44
I must have spelled HPWM wrong. :confused:

Kenjones1935
- 16th April 2011, 17:13
PICs are often used for controls. Do you all know of any available simulation packages?

ScaleRobotics
- 16th April 2011, 19:02
Here are some of the ones I know about. However, nothing is quite like the real thing. Especially when timing is important.

See the bottom of the page.

http://www.picbasic.co.uk/forum/content.php?r=95-Some-electronics-links

Kenjones1935
- 17th April 2011, 01:29
Looks interesting, but I do not understand..... VBB says it is Arduino oriented.

"http://www.picbasic.co.uk/forum/content.php?r=95-Some-electronics-links" contains:

"http://www.virtualbreadboard.com free, nice graphics, some bugs, and some rebooting reported
Might work better with XP than newer Windows OS's."

Ken

ScaleRobotics
- 17th April 2011, 02:51
VBB is tri-lingual. It can do Arduino, Amicus, and 7 flavors of Microchip. I have not looked at it for a few months, but for free, it looked pretty cool. But, the closest thing to an 887 that it has is an 877.
Walter

ScaleRobotics
- 17th April 2011, 16:20
Oops, I guess it is not free anymore. Or at least, only free for 10 days. Looks like it is 9.95 for one month, or 59.95 for a year. They have added a few features since I last looked. Here is a shot from their logic probe demo:

http://www.picbasic.co.uk/forum/attachment.php?attachmentid=5355&d=1303053492

And I guess there are 9 chips it supports from Microchip:

http://www.picbasic.co.uk/forum/attachment.php?attachmentid=5356&d=1303053581

Kenjones1935
- 16th May 2011, 16:25
Folks from MIT's Lincoln Laboratory have taken an interest in my robocars for kids. LL has an Education Outreach program which schedules workshops each summer. If you like go to
http://roboworksmay22.eventbrite.com/

Note the sentence:

Follow-on workshops are planned for the summer where kids will learn to program general purpose processors to control sensors for an autonomous robotic NASCAR.Let me THANK YOU ALL for all for two year's of support. LL seems Arduino oriented. :( I don't know why, but they have the resources and the prestige to take this to the next step.

I'll keep you informed if I can.

Ken

mackrackit
- 17th May 2011, 01:09
Hi Ken,

Sounds like things are finally rolling for you.

You may want to look at this section

http://www.picbasic.co.uk/forum/content.php?r=346-amicus18

It is a hardware replacement for the ardrino that uses PICs and PBP.

Kenjones1935
- 15th June 2011, 03:36
Hi everyone, I have not disappeared..

I have a PBP question/problem. :confused: I need to create a pulse width modulated pulse every 20 milliseconds. I also need to have the PIC be doing all its work between these 20 msec events.

INTERRUPTS should do it, but I have not been able to decode the manual on how to use them. How do I (can you point me to an example?) set an interrupt for when a 20msec timer (driven by the 4mhz oscillator) overflows? During most of the 20 msec the PIC has to do its sensor triggering and decision making business. Every 20 seconds it must send out two carefully crafted pulses to the Electronic Speed Control and to the steering servo.

Help.....

Kenjones1935
- 24th November 2011, 21:39
Here I am again..... My R/C based model car robot is being marketed by Ten80 Education. The kit is down to aproximately $110. The target students are in middle school - seventh and eighth grades - ages 12 to 14. How do we help young folks conceptualize the microprocessor domain? -- Particularly without electronics like an oscilloscope? Please help me think of 'real world' examples like one demonstrating a millionth of a second and/or a machine driven my a megahertz clock.

Here's a short list

An Input - An Output - A pin
A signal -- a Digital signal -- an Analog signal
A microsecond - A millisecond
A pulse - The pulse width - pulse frequency
Ground (Gnd) - Operating voltage (Vcc) - A voltage regulator
Noise - DC motor - Electro Magnetic Force (emf) - Back emf
Servo
Resistance - A resister
microprocessor architecture terms
sonar - speed of sound

Ken

mackrackit
- 27th November 2011, 00:52
http://jricher.com/NEETS/

Kenjones1935
- 27th November 2011, 03:15
http://jricher.com/NEETS/

Thank you, Dave. That is exactly the kind of reference I need. :D
Got more ideas?

Paolo76
- 21st October 2016, 12:56
I wanted to know if the code that was posted for the ESC circuit goes equally well for a 16F84? Or you must adjust the appropriate door? Thank you very much.