![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Mike,
Your idea actually borders on "genius". I'm not familiar with MikroBASIC but in Swordfish BASIC it's very easy to setup one of the FSR registers to point directly at an array so you could deposit incoming characters directly into the array. Pretty cool, huh? Code:
' Swordfish BASIC ' DIM RxBuffer(256) As Byte FSR0 = @RxBuffer |
|
|
|
|
|
|
(permalink) |
|
I prefer SF over mB for a lot of reasons. I started PIC's with mB and ASM, so I still run my code off some of my original stuff in mB. I am having some problems with inline ASM in SF and that's why I chose mB, because I can debug it quicker in case of problems.
|
|
|
|
|
|
|
(permalink) |
|
Warren,
Perfect 5 cycle timing, true or false. Well done. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Mike. |
||
|
|
|
|
|
(permalink) |
|
Forget the last post. The problem only occurs when you don't have file to file transfer and auto resetting of RCIF. Actually, can't a related problem occur. The interrupt reading the byte and clearing the flag, making RXREG invalid.
Mike. |
|
|
|
|
|
|
(permalink) |
|
I was troubled by the same thoughts when I realized that the interrupt could occur at any point. The saving part is that the RCIF flag will not clear until the RX buffer is read and empty. Just in case, the ISR will finish the job....
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
Oh.. and the stop timer thing is a Bob Ammerman trick I think. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
Mike. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
Edit: I took a look again.... you have a point I think... interesting. Last edited by wschroeder; 6th December 2007 at 04:59 AM. |
||
|
|
|
|
|
(permalink) |
|
BTW, when you originally posted the link I assumed someone else had written the code. As it's now clear that you wrote it, can I congratulate you on a very clever and elegant solution.
Mike. |
|
|
|
|
|
|
(permalink) |
|
Thank you. It's getting late here and I play too late and too much. If you think of a solution please post something... I'll pick it up in the morn. Amazing how a simple interrupt can throw a wrench into a good thing....
Edit: Before I go... how about deducting a couple TMR1L cycles right before doing that instruction. You would get an error of 30 - 60 or more cycles at 100ns each out of the whole 20ms. That wouldn't hurt anybody. But it could prevent an interrupt at the wrong time. It would require a little change in how the RCIF test is done and acted upon. Just a tired thought and maybe the same problem. Last edited by wschroeder; 6th December 2007 at 05:39 AM. |
|
|
|
|
|
|
(permalink) |
|
So it looks like by using the decade counter we can get away with 10 servos per pin? Damn!
Servos seem to be getting a lot posts around here lately, it's nice to have all these ideas being discussed, I was having a hard time locating a comprehensive tutorial. Last edited by Ambient; 6th December 2007 at 06:57 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Mike. |
||
|
|
|
|
|
(permalink) |
|
Actually, now that I think about it a little more, I can control the amount of time each servo receives a pulse from the 4017, but after the decade counter resets and I start the 1st servos pulse again, I can end up changing the carrier frequency of each servo. But can I fix this by simply using the tenth decade pin and hold it to keep the total refresh rate the same? The problem is, if the first 5 servos with the lowest PWM values, then the sixth servo will have a higher carrier freq. So will a changing carrier frequency screw up the servos?
I could fix this by just using every other channel, so 5 per 4017. That way I could control the time between each servo even being pulsed. Or I could just use two demux's might be less work that way. Last edited by Ambient; 6th December 2007 at 07:43 AM. |
|
|
|
|
|
|
(permalink) |
|
Ambient,
There is a more fundamental problem with the 4017 solution and that is that the total time frame will be minimum 18*1mS and maximum 18*2mS. You could use just 5 outputs per 4017 but then your frame time will be roughly 18*2.5mS. Unless you need better than 8 bit accuracy then I think the software solution may be more suited. Alternatively, 2 16F88 could be configured to do 9 servos each with much higher resolution. Using the internal clock, you could get a resolution of 500nS. I could help with the code if you choose this route. Mike. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| 555 servo controller? can get them working | lompa | General Electronics Chat | 9 | 31st May 2007 06:24 AM |
| Help required with servo motor controller | mayhem | Robotics Chat | 3 | 26th May 2006 04:21 PM |
| Auto servo controller, need help with the 555 | linuxglobal | General Electronics Chat | 2 | 20th April 2006 03:52 PM |
| looking for servo controller circuit diagram using switch ? | calico | Micro Controllers | 49 | 27th February 2006 01:35 AM |
| Help me start, making a servo controller for motorcycle use. | motoracer | General Electronics Chat | 4 | 11th November 2003 10:29 PM |