PDA

View Full Version : Help! help with pic code please


Chippie
Feb 11, 2007, 08:21 AM
I'm tasked with coming up with a pic based level control for a boiler on my friends steam ship.

I have got the level measurement part sussed using a 4093, the output of which toggles a pin on the pic.

Now, I've cribbed some asm from somewhere else, modded it so far,by deleting the references to the 'centre' functionality, but now I'm struggling to get it to do what I want.


Basically, there is a pot input to GP2, this is used to set the stroke or rangeof the servo's movement. GP1 is currently set to sweep the output of the pic, so the servo shuttles back and forth. What I want to do is, when GP1 is high, the servo is in one position and when it is low, the servo takes up its opposite position.

Could someone take a peek at the .txt file and identify for me where I need to make my changes please?

Acetronics
Feb 11, 2007, 11:07 AM
Hi, Chippie

Can you confirm ???

You're looking for how to make a "bistable" servomotor , driven by a simple switch ???

I did last month such a circuit for driving a "water bomber" bay ... with two contra-rotative servos !!!

Alain

Chippie
Feb 11, 2007, 11:50 AM
Alain,

Yes that is correct....

The original circuit I was going to use was problematic and didnt do what was required.

Now having a level measuring circuit that superimposes an AC signal on the level probes(this prevents polarisation when using a simple dc circuit...) its more reliable, however the servo drive part is what I've having difficulty with, hence my using a pic.( I guess I could use a 556 configured but the component count is high and space is at a premium.)

redfoxen
Feb 11, 2007, 09:47 PM
Hi Chippie:
You Must change boilerservo.txt to .boilerservo.asm;and use the "MICROCHIP MPASMWIN.exe" to make the *.HEX;
THE HEX PRORAG FOR "boilerservo.txt":
*******************************************
:020000040000FA
:1000000020288207FE34CD34993466344D343E3492
:10001000303422341A3413340D34093406340434A1
:100020000234013432082B02031D182831082A0239
:1000300008002B083402031D1F282A083302080079
:10004000E920B820C120B2202A20272021280C1C1A
:1000500027280800B501B601003803193928AC1863
:1000600058283E28FF30AD000130AE00AC012C1402
:100070000800B601B5014628AC184F288F202B0880
:10008000AE002A08AD00AC012C1508008F2012200C
:1000900003183E28192003183E28322808008F2014
:1000A0007D208B20371C56285E2008006F2008001A
:1000B0008F207D208B2037145E2008003608BA0779
:1000C0000318B90A391D6A280330AE00FF30AD00AD
:1000D000371008003908AE003A08AD0008003608AD
:1000E0003A02AD003908031CFF3EAE00AE1F080007
:1000F0000030AE00AD0037140800AA0CAA0CAA0C00
:10010000AA0CAA0CAA0C0330AA05AB0DAB0D0C303F
:100110002B052A0408000120B600B50108008B3029
:100120009F009F18912883161E088312AA00AD0015
:100130001E08AB00AE0008000301B100B200B3001E
:10014000B4002A080A3EB1002B080318013EB20091
:100150000A302A02B3002B08031CFF3EB400003013
:10016000B4020800851CB5280034AC01AC14FF347F
:1001700005143B308F00BB308E00013090000C1016
:100180000800D6202E08B9002D08BA000301AD04DE
:100190000319CC28AD0BCA280301AE040319D428D7
:1001A000AD0BD028AE03CC28051008000330A10009
:1001B000D230A000A00BDA28A10BDA280800043006
:1001C000A000A00BE12800000000000000000000DB
:1001D00008008312850107309900831624309F00A0
:1001E0003E308500831289309F00AC102C158F2083
:0A01F000B601B5010130B8000800A7
:02400E00923FDF
:00000001FF
******************************************
GOODLUCK;
That I simulate the "boilerservo.hex", like the servo text program;
Maybe,THE INPUT SIGNAL TO GPIO.2 AMYBE YOU CAN USE "HALL Sensor";
Like the "ANALOG TYPE gyrosccope";

MAYBE ,THE "ADXL202E" Is the best choose;

Chippie
Feb 12, 2007, 02:23 AM
Thanx,

I've already assembled the modded code,what I need to know is what part of the asm code to modify so that when the input pin is toggled the servo folows that action.....

Acetronics
Feb 12, 2007, 04:20 AM
Hi, Chippie

I've just simplified the existing code ... a little more time to test that in real life ( 12F675/629 Pic ), and I post you the code, scheme and PCB drawing.

Still interested in ???

last question ... do you have a PBPro compiler ???

Alain

Chippie
Feb 12, 2007, 07:36 AM
Alain,

top man, I'm using MPLab, I dont do basic.... :p


cheers,

John

Acetronics
Feb 12, 2007, 07:55 AM
Hi, John

No problem ... I'll send you the .Hex !!! :rolleyes:

Ah, ... Brilliant tries : it works as expected !!! :p

Just think to PM me a Mail address ... too large files for this forum !!! :censored: ... as always !!!

Alain

MatC
Feb 12, 2007, 10:15 AM
Hacking and modifying someone else's code you don't understand by someone else into something you still don't understand might not be the best way to go if you want this thing to work well.
Programming a PIC to do PWM output according to a digital and two analog inputs isn't too hard, get to know MPLAB and its simulator, and consider using C or Basic or something.

Easier still... find one of the nice 555 based servo-tester circuits online, and modify that a bit to give one of two outputs depending on your sensor input. Will be a lot easier to make it work well.

Chippie
Feb 15, 2007, 03:08 AM
Hacking and modifying someone else's code you don't understand by someone else into something you still don't understand might not be the best way to go if you want this thing to work well.
Programming a PIC to do PWM output according to a digital and two analog inputs isn't too hard, get to know MPLAB and its simulator, and consider using C or Basic or something.

Easier still... find one of the nice 555 based servo-tester circuits online, and modify that a bit to give one of two outputs depending on your sensor input. Will be a lot easier to make it work well.

A slight contradiction there dont you think..... hacking code versus hacking a 555 circuit? :p

I prefer to stick to assembler, Mplab suits me without having to learn other languages and having to use the relevant assemblers.......

Thanks for your input ;)