Results 1 to 10 of 22
- 11-06-2008 10:14 PM #1
SatelliteGuys Senior
- Join Date
- May 11th, 2008
- Location
- SE Texas
- Posts
- 771
Polar Rotors and Servo Controllers 101
ADVERTS
I hope for this to be a continuous work in progress, and we can learn and accomplish something along the way. The more that play the more we will all learn.
I ordered that servo controller kit I mentioned in the G box thread. For anyone interested, I ended up getting it from here -
The sales rep's name was Sue. Very courteous and professional. I told her a bunch of yall would be calling too!Code:hXXp://www.electronics123.com/s.nl/it.A/id.316/.f
I also picked up some 556s and sockets to build the PWM test rig.
I did not find what I was looking for in the remote control dept...........yet. I imagine something is commercially available, but cost eventually becomes an issue.
I had a couple of thoughts. One will require the assistance of our appointed PIC subject matter expert. If the PIC16C71-04/P has the room for the code to learn, and act on existing IR commands at our disposal, all that would be needed is to add a 38khz ir detector and supporting code. What do you think Cad? I'll post the code for the PWM unit at the end of this post.
The other idea I had involved some HW mods to our various STBs. I've been eyeballing the useless tv/vcr function on my remotes and wondering if I could intercept that control sig and route it to a jack on the back of the rx[s] and use it as an input state [H or V] to the PIC. Things that make you go hmmmm........
Here's the code per the .pdf Cadsulfide. Please comment. It's all geek....er, uh, greek to me........lol
Here is the pic of the 556 based servo test rig, courtesy of Tom Dickens -Code:;KIT 102. SERVO-MOTOR DRIVER dummy = 14h flag = 15h servo0 = rb.5 servo1 = rb.4 servo2 = rb.3 servo3 = rb.2 org 0 jmp start org 4 ;Interrupt jumps here clrb RTIF setb flag.0 reti start mov !ra, #255 ;Set ra to input. mov !rb, #0 ;Set rb to output. clr rb ;Clear port rb mov dummy,#255 mov intcon, #0 ;Turn interrupts off. mov adcon0,#AD_ctl ;Set AD clock and channel. setb rp0 ;Enable register page 1. mov adcon1,#AD_ref ;Set usable pins, Vref. mov option,#00001000b ;WDT on, no prescale clrb rp0 ;Back to register page 0. setb adon ;Apply power to ADC. setb go_done ;Start conversion. not_done snb go_done ;Poll for 0 (done). jmp not_done ;If 1, poll again. mov counter2,adres ;Move ADC result into counter. mov integer1,#3 ;Offset constant mov integer2,#5 ;ADC multiplier setb servo0 ;Output pulse to servo 0 call delay clrb servo0 call pause ;ADC settling delay clrb rp0 ;Ensure reg page 0 clrb chs1 ;Select channel 1 setb chs0 ; Ain 1 mov dummy,#255 ;Reload dummy variable clrb adres ;Make sure setb go_done ;Start conversion. not_done1 snb go_done ;Poll for 0 (done). jmp not_done1 ;If 1, poll again. mov counter2,adres ;Move ADC result intocounter. mov integer1,#3 ;Offset constant mov integer2,#5 ;ADC multiplier setb servo1 ;Output pulse to servo 1 call delay clrb servo1 call pause clrb rp0 ;Ensure reg page 0 setb chs1 ;Select channel 2 clrb chs0 ; Ain 2 mov dummy,#255 clr adres setb go_done ;Start conversion. not_done2 snb go_done ;Poll for 0 (done). jmp not_done2 ;If 1, poll again. mov counter2,adres ;Move ADC result into counter. mov integer1,#3 ;Offset constant mov integer2,#5 ;ADC multiplier setb servo2 ;Output pulse to servo 2 call delay clrb servo2 call pause clrb rp0 ;Ensure reg page 0 setb chs1 ;Select channel 3 setb chs0 ; Ain 3 mov dummy,#255 clr adres setb go_done ;Start conversion. not_done3 snb go_done ;Poll for 0 (done). jmp not_done3 ;If 1, poll again. mov counter2,adres ;Move ADC result into counter. mov integer1,#3 ;Offset constant mov integer2,#5 ;ADC multiplier setb servo3 ;Output pulse to servo 3 call delay clrb servo3 sleep jmp start ;Time out after 18 msec ; The number of loops this delay routine makes is dependent on the result of ; the AD conversion. The higher the voltage, the longer the delay. delay clrb rp0 ;Page 0 mov intcon,#10100000b ;Enable RTCC interrupt ;****************** Fixed delay part of routine **************** delay1 mov RTCC,#55 ;Fixed delay wait1 jnb flag.0,wait1 ; of 200 till interrupt clrb flag.0 ;Flag set on interrupt djnz integer1,delay1 ;Three times through ;****************** Variable delay part of routine ************** sub dummy,counter2 ;RTCC counts UP! load mov RTCC,dummy ;Load RTCC wait2 jnb flag.0,wait2 ;Note infinite loop clrb flag.0 djnz integer2,load ;Five times through mov intcon,#0 ;Disable interrupt ret pause mov counter1,#120 ;Adds a short settling settle djnz counter1,settle ; time to the ADC ret *************************************************************
Last edited by melgarga; 11-07-2008 at 01:06 PM. Reason: Cleaned up bad lines created by wordwrap mode
- 11-06-2008 10:14 PM # ADS
Paying The Bills With Google Adsense Circuit advertisement- Join Date
- Always
- Location
- Advertising world
- Posts
- Many
- 11-07-2008 10:42 AM #2
Mel, Great post! You'll end up like Linuxman & Anole with Ham radio if you start playing with small micro's!
Your listing is in assembly, very compact, very fast, a lot of work. It will take some time to learn. The Microchip web page has a lot of code development tools free for the downloading
MPLAB Integrated Development Environment
.
I also use the MElabs Basic compiler
microEngineering Labs - Development tools for Microchip PICmicro MCUs including PicBasic and EPIC programmer
, you can plug working assembly code into it, a solid compiler and only $99 for the starter version.
I recommended the Basic stamps only because they have a built in interpeter, they are way more expensive in the long run than generic PIC's, but are a good starting point.
For the extra dollar or two per chip, get the 'F' version for flash, programming is an endless cycle of writing code, downloading it to the target, watching it crash, fixing the code, downloading it to the target, hopefully it works, etc. Flash lets you reprogram the same chip hundreds of times instead of only once.
A hint on prototyping, use sockets on bare perfboard, and wire your connections with 30awg kynar wire wrapping wire, easy to weave through the holes and easy to rewire if you change your mind or get an oops. Jameco, Digikey, Marlin P. Jones, and Allelectronics are good resources.
Also check out
ExpressPCB - Free PCB layout software - Low cost circuit boards - Top quality PCB manufacturing
great free pcb software, once you get something you like running well, you can make lots of copies cheap.
- 11-07-2008 12:56 PM #3
SatelliteGuys Senior
- Join Date
- May 11th, 2008
- Location
- SE Texas
- Posts
- 771 Thread Starter
Oh, I've been around a while, just not in the micro scene. Got my Novice in '76, Advanced a little later and finally upgraded to Extra in '88. All before the code free ruling, which I think was another poor decision on the FCC's part. Extra is more about rules & regs than theory, which make sense if your going to be a VE.
I've played in basic in the trash80 and Vic 20/C64 days. Never went CoCo, My first XT had dual 360 floppys and later I acquired a 5 MEG! hd........lol. Still got it around here somewhere, just waiting to buy me a boat so I have a use for it again.......lol. Heck I've still got a couple of C64s a Vic, a couple of 128s an Apple or two and even an old TI99 somewhere. One of the first things I did when I got the 64 was to build a CW i/f for the expansion port. hooked it up to the 101EE and started copying cw on the screen. Back then that was COOL!
I dabbled in 6502, 6805 and Z80 assy, but never did anything remarkable. Wrote a random cw generator/trainer from scratch, very sloppy but it worked. I'm comfortable in the asm/dis environment, give me a list of opcodes and an I/O & reg map and I'll figure out the rest.......lol. C++ confuses me, too abstract. I've used some (i386) compilers to compile others work, but havent taken the time to get to know C++ or any other HLL for that matter.
Thanks for the links to all the info, regarding the Stamp & interpreter, my point of reference is the CBM C64 and it's basic interpreter. Is that a valid analogy?
In PIC terminology, F is for flash, which I do understand EEPROM and principals, so what's the 'C'? I admit I've not looked into anything regarding PIC or micros in general, it has really only peaked my interest since we started down the PWM/servo path. I should prolly get me a PIC for Dummies and take a stab at a code revision for the IR addition to this kit, if there's even room for it. If I take a stab at it and can throw something together, perhaps you can show me the error of my ways if I cant get it going.
Thanks again for the reply and the links. I imagine I'm not done leaning on you if this all materializes like I hope.
- 11-07-2008 01:08 PM #4
Stuck thread... good info! I still have my C64 and 128B... need to see if they still run.
C-Band FAQ's, The List, SatelliteGuys Cutting Edge, Home Theater Equipment, Primetime,
2012 CES, droids
dfergie@SatelliteGuys.US
For Breaking Satellite Industry News, Please Click Here
- 11-07-2008 02:33 PM #5
Oh great... I just blew the dust off my 1987 copy of "Using Assembly Language"...
Wonder if I'll ever be able to get all the Visual & .NET garbage out of my head long enough to remember what I was doing in college...
I'm more than willing to help on this where I can - gosh I've forgotten most of this stuff...
- 11-08-2008 09:05 AM #6
Mel,
The 'C' is for the OTP (one time programmable) versions. The 16F84 is my current fav. The PIC's a remarkable little jellybeans, you can do a lot of stuff in only 1K of code space. I've used them for DC motor control (PWM function in basic), Built a solar panel calibrator with one, annunciator panels (serial lcd), doing a RC servo should be a fun project. The 555 timer circuit should work, but won't be real stable.
We date from the same time period. I've done 8051 & 8088 code, did some VisualBasic code for machine control, but never learned to write C (!@#%%^). As Steve Ciarca once said "My favorite programming language is solder"
I remember back in the day, I was a member of the Heath Users Group, one of out members used a COCO with a thermistor sensor on the the joystick port to sense temperature in his shop and open & close a damper on his wood burner.
- 11-08-2008 12:46 PM #7
SatelliteGuys Senior
- Join Date
- May 11th, 2008
- Location
- SE Texas
- Posts
- 771 Thread Starter
After I made that post I went a googlin' and determined several things, one of which was the C designator being for OTP. That ends the chances of using the micro shipped with the kit to add any ir routines, but I did find a compatable 'F' unit that looks to be promising. Microchip even publishes a migration paper for the PIC16C716 to PIC16F716. A few chances, but a quick look doesnt reveal any conflicts with swapping in the flashable unit.
A 38khz detector, a snapshot of the binary values of desired ir codes (we only need one if we are only going to toggle H/V), I think Girder can capture that. So FW wise we declare it (variable), scan the ir input, (it will be serial so......that could get interesting) compare it to the stored value of the variable and toggle...........what? Actually I suspect we will only need the small part of the string that is unique, after all we are picking one command not decoding the whole set.
The micro code is written to take advantage of the ADCs. The HW solution would be to use outputs to pull up or down a fixed value resistor of the appropriate value on the ADC input. PRESUMABLY, FW wise one could toggle the correct values in the ADC reg and let the program contiue as if it were an actual input. I would guess that if a bit is programmed as an input, the 'real' value would overwrite any value placed in it's reg internally. So point the proggy to the GPRs and use them instead? Prolly a lil more code needed as well to insure a toggle command would produce only one change in state per button press.
I'm anxious for it to get here, but I'm going to go ahead and order the "F" unit so I'll be ready to move to the next level. I feel pretty confident this will work as a manual control, so getting the couch potato mode working is the challenge.
- 11-08-2008 01:29 PM #8
With most of the 14 bit PIC's, code is compatable, you just have to remap the I/O and maybe a register or two.
- 11-12-2008 11:18 PM #9
SatelliteGuys Senior
- Join Date
- May 11th, 2008
- Location
- SE Texas
- Posts
- 771 Thread Starter
Feed the Monster
My new toys arrived today, but it looks like I wont have time to play until this weekend. Has anyone else decided to test this or another design for the project?
I've done some additional searching regarding ir control and come up with several PIC based sources with various add'l features, but it all adds to the cost. None are based on the same PIC, and none appear to have the code available without purchase. Actually, I am presuming that the code is retrievable, possibly even available on request, but I havent gotten that far. Is it possible to be locked from being read Cadsulfide?
It is more cost effective and realistic to merge the code from both the PWM and ir cortrol functions to a single micro based unit. As Cad pointed out porting between units in then same family appears to be a minor retrofit in most cases. Prototyping is always more expensive than production, hence "Feeding the Monster" so after I prove, or disprove that the PWM unit will work for our purposes, I will choose a suitable ir system and attempt to marry the two modules, with the ultimate goal being an intregrated unit. Once it is established what micro, code and configuration works, a plan will be available for those interested in building a stand alone unit that can be run from a universal type ir remote.
Here's some stuff I've dug up for the ir side if anyone would care to look it over -
This is a very enhanced system that can be expanded well beyond our needs to a number of additional ir command controls. Could be VERY cool for a variety of things one may want to couch potato control.
pros - 12 discrete or 22 mux'd outputs, ir learning mode, remotable[ off main pcb] ir detectorCode:hXXp://www.tauntek.com/tinyir2-learning-ir-remote-control-receiver.htm
cons - pricey for the scope of our project, but value added if the extra output can be utilized.
Here's one that could be tweaked for our purposes, or glean out the cool A/V control features and add them to our "monster" or pretty cool just as it is for non HD A/V control features. Links to schematic, source, etc are on page 2 It's not a kit, so construction would be beyond beginner level skills.
This looked good at first, but when shipping [to Texas] more than doubled the cost, and had less features than #1 above, overall I dont consider it a value. Might work for someone that can get it for at or near 12 buck for the kit + detector.Code:hXXp://web-ee.com/schematics/video/remote-controlled-av-switch/
This is just a small sample of info on PICs and ir control. Anyone find something in this vein that looks promising , post it up and lets kick some ideas around.Code:hXXp://www.rentron.com/remote_control/IR-D14.htm
So there's the latest guys. Step one is to define the servo parameters, then marry the modules, and finally merge to a single micro based design if possible. We have the grands every other weeekend, and this is the off week, supposedly....lol, so I hope to have something to report. If anyone else has successes or failures to report chime in, this may not be 'cost effective' but it should be enlightening and fun, besides, what else are you going to do, actually watch TV?.........that stuff lowers you IQ
- 11-13-2008 11:07 AM #10
Tons of PIC forums out there, you should be able to find example code for free for just about anything. The Microchip lineup has everything from small & cheap to all-inclusive & spendy. Pretty easy to network two processors together using I2C while developing. With 1 &2 K of code space you can do a lot, but can run out of room. I'll do some poking around for some snippets to post.
Mel, you're gonna get hooked I can just tell :-)
-
Advertising
- SatelliteGuys.US
- has no influence
- on advertisings
- that are displayed by
- Google Adsense








LinkBack URL
About LinkBacks
Reply With Quote

Forum Threads
Bookmarks