Thread: LMD18201
View Single Post
  #28   Spotlight this post!  
Unread 24-07-2007, 11:00
sciguy125 sciguy125 is offline
Electrical Engineer
AKA: Phil Baltar
FRC #1351
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Sunnyvale, CA
Posts: 519
sciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond repute
Send a message via AIM to sciguy125 Send a message via MSN to sciguy125 Send a message via Yahoo to sciguy125
Re: LMD18201

Quote:
Originally Posted by Generalx5 View Post
Anyone know a simple decoder I can easilly make on a PCB board? Eds link has something thats too complicated. I just need a basic RC PWM to Standard PWM converter, a small pakage would be nice.
I was playing with this about a year and a half ago. I made a speed controller based on an L298 and 12F683 (one of the 8 pin PICs). The PIC is essentially being used as an RC PWM to traditional PWM converter (two outputs to control an H-bridge). It works, but it has some software bugs. (the only one I can recall off the top of my head is that if it loses the input signal, it defaults to full speed forward)

The basics of what it does:
1. When you get the rising edge of the pulse, start a timer.
2. Stop the timer on the falling edge.
3. Do some checks to make sure that it's a valid signal.
4. If it's 1.5ms, set outputs to 0. If it's >1.5ms, calculate the appropriate duty cycle and set outputs for forward. If <1.5ms, calculate appropriate duty cycle and set outputs for reverse.
5. Wait for next pulse.

I've attached the code for it. I have to warn you though, the bugs aren't documented and the comments aren't the clearest or most complete. Depending on what you're trying to do, you may or may not want to fix the bugs. Actually, you know what? I would advise that you don't actually use it. Instead, you could use it as a reference if you decide that you want to make your own converter. It's been so long that I don't even remember what all the code does. If you're just looking for a toy though, you should be able to just load the code into an appropriate PIC and plug it all in.
Attached Files
File Type: txt sc_servo.asm.txt (6.9 KB, 97 views)
__________________

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GE/S/P a-- e y-- r-- s:++ d+ h! X+++
t++ C+ P+ L++ E W++ w M-- V? PS+ PE+
5- R-- tv+ b+ DI+++ D- G
------END GEEK CODE BLOCK------