Jump to content
Sign in to follow this  
Guest LeoL

Decoding rotaries using a PIC

Recommended Posts

Guest LeoL

>Tried various resellers including the big RS-Components: none has >the 676 or the 630.>I'm requesting the samples.Might take a couple of weeks...so don't loose hope. ;)>Now about programming: i assume that reading it and knowing where to >read i can take the osc calibration value.>But how do i program it?>What programmer do you suggest me to build?Don't plug the 630/676 into any programmer. Its not pin compatible with standard PICs. That's why you need to use the ICSP to connect to it. For details on how and why, go to my RD-PAN16F page. I wrote all this out step by step so there's no point repeating it here. If you still have questions, just email me.I use IC-Prog (newest Beta version) and JDM programmer I built from spare components. (links on my page)>And also, how did you know i'm in Rome? :(I have friends everywhere...I know everything you do! :D I simply checked your profile on the forum. :-roll-Leo

Share this post


Link to post
Share on other sites
Guest

>Might take a couple of weeks...so don't loose hope. ;)Will wait (im)patiently ;)>>But how do i program it?>>Don't plug the 630/676 into any programmer. Its not pin>compatible with standard PICs. That's why you need to use the>ICSP to connect to it. For details on how and why, go to my>RD-PAN16F page. I wrote all this out step by step so there's>no point repeating it here. If you still have questions, just>email me.No, the pins were not the problem i was talking about, rather the config flags, registers, data memory addresses...The programmer must know the address of all the above to correctly program the device.Is there any shortcoming in programming it like it was a 12F675 like you said?Should i manually reprogram the osc calibration?The software of my programmer automatically leaves the osc value untouched for those micro who use that value.Instant update:i've just tried to load your hex with the 12F675 selected and the software didn't show any warning.May i trust it?

Share this post


Link to post
Share on other sites
Guest LeoL

>No, the pins were not the problem i was talking about, rather the>config flags, registers, data memory addresses...The 12F275 does match the control flags and memory addresses. You should only select this model to program the 630/676 and not as a replacement for the 676. This is what I was using until the Beta release of IC-Prog added support for the 676.As for the osc value, make sure you read the PIC the first time and write it down on the chip. You may need to erase the PIC at some point and you'll loose this value 4ever. Its happened to me ... ;)I don't know the internal structure of the 12F675 so I can't tell you what would happen if you used it instead of the 676. Unless all the internal registers and port addresses match, the firmware won't work properly.-Leo

Share this post


Link to post
Share on other sites
Guest

Hi Leo!I finally got my 676!I got 3 (kindly provided by Microchip).Now i have to wire them to the programmer, flash'n try (TM :-lol) and dicide on how to use them.Wish me good luck :)

Share this post


Link to post
Share on other sites
Guest LeoL

Hey great! BTY - set the Brown-Out Reset (BODEN) flag when you burn the PIC, er I mean "program" the PIC ;)I noticed that on reboot, the PIC sometimes freezes. With the BODEN set, the PIC restarts itself when the power drops too much. Those Microchip boys thought of everything didn't they. ;)-Leo

Share this post


Link to post
Share on other sites
Guest

>I noticed that on reboot, the PIC sometimes freezes. With the>BODEN set, the PIC restarts itself when the power drops too>much.Didn't the brown out need a periodic clear of a bit?Was it another timer?>Those Microchip boys thought of everything didn't they.>;)Sure!Otherwise we wouldn't all be using their products ;)

Share this post


Link to post
Share on other sites
Guest LeoL

>Didn't the brown out need a periodic clear of a bit?>Was it another timer?No, you're thinking of the "watchdog timer". The BODEN is self contained watchdog that restarts execution of the code once the power source reaches the nominal level. You may not need it. I get my voltage source from my USB 64 input module. When the USB host enumerates the USB devices, it seems to cause the PIC to freeze due to power fluctuations.So unless you have the PIC hooked up to some type of bus powered USB device, you'll probably not experience this problem.I also set the "powerup timer" config bit and this should take care of most typical powering up problems. The BODEN makes a good "just in case" precaution if the voltage dips too low and hangs the code.-Leo

Share this post


Link to post
Share on other sites
Guest

>You may not need it. I get my voltage source from my USB 64>input module. When the USB host enumerates the USB devices, it>seems to cause the PIC to freeze due to power fluctuations.You are far beyond my ability to understand: have you really made your own USB input module????I looked around a bit, and even found ready-made C code for pics to control the USB bus via a Philips chip (don't remember what however); but i never found anything not even a single word about the pc-side software.I bet you're a really hot C++ programmer...Whish i were...>So unless you have the PIC hooked up to some type of bus>powered USB device, you'll probably not experience this>problem.Have you used a low-dropout voltage regulator for the pic?Even if the voltage on the bus is stabilized, fluctuation may well occur (and you already learned that), so a voltage reg is always used, also in case of already reagulated power bus.>I also set the "powerup timer" config bit and this should take>care of most typical powering up problems. The BODEN makes a>good "just in case" precaution if the voltage dips too low and>hangs the code.I always use the power-up timer.Ever since i didi my first blinking led soft :)

Share this post


Link to post
Share on other sites
Guest LeoL

>You are far beyond my ability to understand: have you really>made your own USB input module????I always follow a simple rule on my projects...why buy things when you can build them yourself at twice the cost! :-lol>I looked around a bit, and even found ready-made C code for>pics to control the USB bus via a Philips chip (don't remember>what however); but i never found anything not even a single>word about the pc-side software.You haven't been looking in the right places perhaps. If you're really interested, go to my web site and look at my links pages. Also, go to www.mikesflightdeck.com for a more complete list of USB related links!>I bet you're a really hot C++ programmer...HA! Yeah right! I might just be good enough to work for MS making bug free applications! :-bat>Have you used a low-dropout voltage regulator for the pic?IMHO, that might be overkill for a simple rotary decoder circuit. The BODEN does an excellent job! Besides, the PIC can run on anything from around 2.5 to 5.5 V (Don't quote me)The USB enumeration process cycles the power to reset all the devices. It does this only once on boot up. After that, everything runs fine.Truth is I don't even know what a "low-dropout voltage regulator" is. Never seen or heard of one. (-:-Leo

Share this post


Link to post
Share on other sites
Guest

Test:i already replayed but the reply didn't appear....Mhh... maybe lost in the shadows of the database :-lol

Share this post


Link to post
Share on other sites
Guest dirkan

Hi folks,some suggestions to this very interesting thread.1. FSBUS router version2 is shortly before going online. Be surprised, how it looks and works. I've done a lot more than planned at first.2. Debouncing in fsbus is NOT done for rotaries. I don't know, who developed the RF-PAN16F thing. Do you think about making it fsbus compatible, by plugging it directly to the bus ?3. I thought about writing pic code for quadrature pulse encoders.Fast turns is a great challenge, The signal edges of both phases are sometimes close together and vary from rotary to rotary. I would not poll, but use the 16F84 PortB interupt capabilities.4 rotaries should be handled by 1 PIC. I will not do this beforeVersion2 and Steppermotor controller is ready.4. There were ideas with 2N2222 or others. Keep in mind, the keys are multiplexed and the results may surprise at first the PIC and second you.kind regards Dirk

Share this post


Link to post
Share on other sites
Guest LeoL

>2. Debouncing in fsbus is NOT done for rotaries. I don't know,>who developed the RF-PAN16F thing. Do you think about making>it fsbus compatible, by plugging it directly to the bus ?Hi Dirk, I developed the RD-PAN16F and I know very little about FSBUS, but from what I understand it uses a matrix approach to button inputs. I developed the PAN16F to interface with my 64 Input USB device, which doesn't use a matrix approach. Anyone, is of course free to modify whatever they like to my design. That is the reason I released the project files and firmware to the public.>3. I thought about writing pic code for quadrature pulse>encoders.>Fast turns is a great challenge, The signal edges of both>phases are sometimes close together and vary from rotary to>rotary. >I would not poll, but use the 16F84 PortB interupt>capabilities.The PIC doesn't poll, and use the port interrupt capabilities also. My USB device does the polling and so does the PC USB Host (@ 10 ms) and this limits how "fast" the rotaries can be. However, I will soon be implementing a software solution for fast rotaries but will be keyboard emulation based for the time being until I develop a proper FSUIPC interface. As Mike suggested in an earlier post, will have an auto rate feature and adjust accordingly (2x, 4x & 8x?) based on turn rate.Cheers,-Leo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...