PWM / SX / H-bridge LMD18200
Rob v.d. berg
Posts: 89
Hello,
To contol a H-bridge (LMD18200), with a 8-bit PWM signal,·I think to use the SX-28. I'm waiting for the C compiler, but·maybe it takes to long. The·PWM·freq·is 20kHz, the PWM steps 0-255. A HALL sensor will sent a puls and a direction (0/1), to get the position back, and with some PD algoritme.
A serial input must by use for sending a new setpoint.·First i will start with the PWM. I have not·much experience with the SX, therefore·any help is wellcome.
spec:
clock: 50Mhz
PWM: 20khz,
PWM steps 255.
Serial: 9600/19200 baudrate
Hall encoder speed ~500/sec
Is this realistic ?
Best Regards
Rob.
Post Edited (Rob v.d. berg) : 3/13/2006 1:43:25 PM GMT
To contol a H-bridge (LMD18200), with a 8-bit PWM signal,·I think to use the SX-28. I'm waiting for the C compiler, but·maybe it takes to long. The·PWM·freq·is 20kHz, the PWM steps 0-255. A HALL sensor will sent a puls and a direction (0/1), to get the position back, and with some PD algoritme.
A serial input must by use for sending a new setpoint.·First i will start with the PWM. I have not·much experience with the SX, therefore·any help is wellcome.
spec:
clock: 50Mhz
PWM: 20khz,
PWM steps 255.
Serial: 9600/19200 baudrate
Hall encoder speed ~500/sec
Is this realistic ?
Best Regards
Rob.
Post Edited (Rob v.d. berg) : 3/13/2006 1:43:25 PM GMT
Comments
I assume you're asking if the SX chip can handle your task (not whether you have the programming chops to do it), right? If the question refers to the SX chip itself, then it should be no problem at all.
Thanks, PeterM
Thanks for your reply,· yes my question was the hardware, and·also what is the best way to start with a simple program. I know that Bean has made some sources for PWM+serial,· maybe that is a good starting point?. Are there orther people·has done something? with PWM?
Regards,
Rob.
In SASM, that is quite a ways a long learning everything about Assembly.
I know you prefer C.
But, you might be able to easily get what you want in SX/B [noparse][[/noparse]which is a version of Basic for the SX chips].
If you have an immediate need or desire to get running -- that is the quickest for now.
Since C is not yet available, it is likely the best place to start too.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)
······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Whenever I am starting a new embedded project on a new platform, I always follow the same basic approach. The exact details may vary, but it usually goes something like this:
1 - Choose language. In this case it's either assembly or SX/B.
2 - Write the basic "Turn an LED on and off" program.
3 - Modify the program to monitor a port input pin and turn the LED based on whether the input is high or low. In other words, you can control the LED via the CPU using a switch attached to the CPU.
4 - Modify the program to blink an LED using some sort of time delay.
5 - Modify it to blink based on the status on an port input pin.
6 - Modify it to blink the LED using interrupts.
7 - Modify it to blink the LED using interrupts but monitor a port input pin in the non-interrupt code and use a flag (or similar mechanism) to tell the interrupt whether it should blink the LED or not.
At this point, a lot of people are probably thinking, "Is he nuts? I want to make my super whizzy whiz bang program of death! I'm not here to mess around with all this LED blinking poop!" However, let's take a look at what we learned by all these little programs (and you did remember to save each different working step, right?) when we're done. We now know:
- How to set port pins to input and output
- How to turn individual port pins on and off
- How to create and set time delays
- How to set up and use interrupts
- How to communicate information between interrupt and main code.
- General knowledge of the IDE and (hopefully) the hardware debugging
Personally, I'd say you're about ready to tackle some serious stuff at this point. Of course, everyone works differently. I see lots of people flounder by trying to tackle advanced projects while barely knowing how to use the IDE or folks who refuse to learn how to use the hardware debugging capabilities that are built into the chip and then wonder why their code crashes.I have no idea what your level of experience is, but after twenty plus years of embedded developing, I find this basic approach always gets me up to speed on whatever platform I'm using. Once you have this under your belt, folding in things like PWM isn't such a big deal since it's just a task running under the interrupt code which you now know how to handle. Being able to tell the PWM how fast to run is handled with your new knowledge of controlling the interrupt code from the main code, etc, etc.
Thanks, PeterM
That's·also my may to do thinks. Start simple. I have a hardware elektronics background, and more than·15 years of (high) level programming (Pascal). And·2 years now with the Javelin.·In the early day's I have learned Z80 code.··I don't want to learn the assemble code for this application, because of the C compiler.
Most of the time it is nice to get a push in the right direction,·to get·feeling with the new·hardware, after that·you can add·your·program to your application.
The most I have learned from software made·by other people.
I will start with a simple test program·for the PWM output on interrupt base.
Regards,
Rob.
·····