Electronics > Beginners

Assembly code Help! PIC16F57

<< < (28/32) > >>

Electrofinn:
Yes your're right, I still have the old mechanism me and my dad made. I remember a lot of the adjustment was mechanical and little was with the pots. The one I have is very crude in how its been cut and drilled but hey it worked very well for a long time. Will be making another but this time I am thinking of having some acrylic laser cut for me.

I will not be using a battery on this, going to power it with a power supply. but i remember battery consumption wasn't all that bad.

A few have wondered why he didn't do it the way you said and I think you're absolutely right about why he ended up doing it that way, I just thought it is was an excellent exercise of how a NE556 could be used and I think in the context of the magazine in which it was published 'Every Day Practical Electronics' or EPE for short and perhaps its target market it was probably very fitting. Not sure what part of the world you're in so not sure if you're familiar with the mag.

Lot of people have said this was one of the most memorable projects of the magazines history and for me it represents some of the happier moments of my childhood, it's a timeless classic, and yes it could be done a lot better but it has a charm about it, And watching my 7yr old's face playing this with it bare and out of its box just as I did when I was his age was special...yeah I gotta get this finished.

Electrofinn:

--- Quote ---This is because of bit zero of new_byte. There is no provision in the program to clear this bit. So if you put a coin in while the pattern is in the second half of the pattern, it will remember this the next time pattern starts being called.
--- End quote ---

Yep, you're absolutely correct, just tested this.


--- Quote ---So it might be awhile, days, maybe weeks. I'm not retired. But the next time I post I suspect I will have either have some answers and/or I'll have some tasks for you to perform using a test code.
--- End quote ---

Yes no worries, fantastic, thank you.

Ian.M:
The NE556 based servo control circuit is still over-complex.  Its fairly easy to use a single 555 to generate a Futaba servo signal - you just need a single diode across the discharge resistor to let it operate as an astable with a  discharge time of approx 18ms and vary the charging resistor to set the pulse width, as small variations in the pulse rate are non-critical.

It could also be done without the transistor - just  let the PIC output feed the short pulse charging resistor.   As  its a pain bit-banging the write-only TRIS register on baseline parts, put a diode in series with the PIC output so it can only source current.  On midrange or better PICs the TRIS registers are memory mapped, so one can easily toggle between Hi-Z input and outputting '1', so no extra diode is needed.

KL27x:
New code revision.

Notice, I messed with timeout, so I hope there is no timeout, at all, now. Of course this might cause other issues, but the point is to see if this is what causes the 2 second (sometimes 30 second) pause. If this is it, then I'll see how best to fix it.

I cleared new_byte,0 in the spot where a coin is detected

and I changed win subroutine.

I believe the duration that pattern2 is displayed is dependent on mode_byte,4 being set. And it is only set when win is active. So it only stays on as long as win is in the middle of being executed. So I modified win so it uses a new register in place of counter_hi to see if this changes anything. (It could also be counter_lo;... but I only have one register left.)

Coped from my code history where I write revision notes. You can view the code changes by going to the labels "v22.x" which will pop up in your warnings when you assemble:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
V22    10/08/2018
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
v22.1    added a BCF new_byte,0 at were coin_counter is incremented

v22.2    locate subroutine responsible for the delay before
      pattern starts up after running out of credits.

x       put test code to bypass timeout to see what happens.

v22.3   win subroutine replaced

   the duration of pattern2 appears dependent on duration of win
   pattern2 is diplayed only as long as win is active.
   win uses counter_lo and counter_hi to determine duration
   
x   replaced busy flag MB,7 with new_byte,1 busy flag
x    replaced counter_hi with counter_higher
0    try replacing counter_lo
 

Electrofinn:

--- Quote ---Notice, I messed with timeout, so I hope there is no timeout, at all, now.
--- End quote ---

Yep, you're correct, there is absolutely no timeout delay now. Also the issue of it not starting at the beginning of "pattern" has happened a couple of times but now it seems it can't be deliberately reproduced, where as before, you knew that if you inserted a coin during second half of pattern that it would always start from 17th value (16th if counting from zero) but now it doesn't. My observation is that it begins at the start of "pattern" very nearly all of the time


--- Quote ---I believe the duration that pattern2 is displayed is dependent on mode_byte,4 being set. And it is only set when win is active. So it only stays on as long as win is in the middle of being executed. So I modified win so it uses a new register in place of counter_hi to see if this changes anything. (It could also be counter_lo;... but I only have one register left.)
--- End quote ---

It appears to be behaving normally, although it's a little early in my testing to conclude. will thrash the hell of this thing tonight.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod