New user help !
New user help !
Hello,
I am a new user and new to programming microcontrollers so I am really lost. I need to develop a display that will read an encoder and display the counts on either an LCD or quad 7 segment LED. I have found a thread where some one posted reading an encoder and displaying it on a LCD but I can not figure out how to simulate the encoder in Flowcode.
I need to develop this display for reading an angle of an adjustable arm on a machine that I am designing. I am quite frankly way past my beginners abilities and am looking for some help in developing this display. Here are the requirements for my display.
PIC Microcontroller 16F series . ( no specific model, recomend best for this application)
2 bit Grey code imput encoder 720cpr
Display to read from 00.00 to 99.99
Display needs to be restable to 00.00 with mometary push button.
I can turn leds on and off and basic stuff like that but this is really over my head. Off the shelf displays are too big for this custom application so my only source is to build the display . Any help or direction would be great I am not loking for free code but some direction so I can learn while doing.
Thanks,
JWalthall
I am a new user and new to programming microcontrollers so I am really lost. I need to develop a display that will read an encoder and display the counts on either an LCD or quad 7 segment LED. I have found a thread where some one posted reading an encoder and displaying it on a LCD but I can not figure out how to simulate the encoder in Flowcode.
I need to develop this display for reading an angle of an adjustable arm on a machine that I am designing. I am quite frankly way past my beginners abilities and am looking for some help in developing this display. Here are the requirements for my display.
PIC Microcontroller 16F series . ( no specific model, recomend best for this application)
2 bit Grey code imput encoder 720cpr
Display to read from 00.00 to 99.99
Display needs to be restable to 00.00 with mometary push button.
I can turn leds on and off and basic stuff like that but this is really over my head. Off the shelf displays are too big for this custom application so my only source is to build the display . Any help or direction would be great I am not loking for free code but some direction so I can learn while doing.
Thanks,
JWalthall
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: New user help !
Hello,
The system refered to in the previous encoder thread may be suitable for your application. It used a particular PIC18 series device which contains a special hardware peripheral for handling quadrature encoders (PIC18F2431). This device is compatible with Flowcode and with the current Matrix PIC programming/development systems.
The encoder hardware is not supported directly by Flowcode but can be easily accessed using C commands from within Flowcode. The use of C commands prevents the code from simulating correctly, but the code runs correctly on the target hardware.
Flowcode is suitable for all the other tasks in your application (reading push-buttons, driving LCD or LED displays, performing calculations, etc.)
The program from the previous thread was developed and tested using the Matrix V3 Development board and an Omron E6A2-CW5 100pulse/rev encoder.
Depending on the expected pulse frequency from the encoder in your application, it might be possible to develop a simple program to monitor the two encoder signals using software only. This would use the detected encoder signal sequence to increment or decrement a counter, which can be converted to an angle before being displayed.
The system refered to in the previous encoder thread may be suitable for your application. It used a particular PIC18 series device which contains a special hardware peripheral for handling quadrature encoders (PIC18F2431). This device is compatible with Flowcode and with the current Matrix PIC programming/development systems.
The encoder hardware is not supported directly by Flowcode but can be easily accessed using C commands from within Flowcode. The use of C commands prevents the code from simulating correctly, but the code runs correctly on the target hardware.
Flowcode is suitable for all the other tasks in your application (reading push-buttons, driving LCD or LED displays, performing calculations, etc.)
The program from the previous thread was developed and tested using the Matrix V3 Development board and an Omron E6A2-CW5 100pulse/rev encoder.
Depending on the expected pulse frequency from the encoder in your application, it might be possible to develop a simple program to monitor the two encoder signals using software only. This would use the detected encoder signal sequence to increment or decrement a counter, which can be converted to an angle before being displayed.
Re: New user help !
Hi Sean,
Thanks for the information. can you tell me have you tried to open this Encoder2.fcf file that was posted? Why I ask is I cannot get the chip to show up on my screen. When I go to the view menu it shows the chip is checked . I uncheck it and then recheck but the chip does not show up. Any thoughts? I really don't understand what you mean buy using C commands to simulate the encoder. Can you elaborate a little more, I am really struggling with this programming.
Thanks,
JWalthall
Thanks for the information. can you tell me have you tried to open this Encoder2.fcf file that was posted? Why I ask is I cannot get the chip to show up on my screen. When I go to the view menu it shows the chip is checked . I uncheck it and then recheck but the chip does not show up. Any thoughts? I really don't understand what you mean buy using C commands to simulate the encoder. Can you elaborate a little more, I am really struggling with this programming.
Thanks,
JWalthall
Re: New user help !
Fixed my chip display problem. Screen on laptop not configujred correctly.
JWalthall
JWalthall
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: New user help !
The PIC18F2431/2331 etc. are part of a small family of devices that contain a 'Motion Feedback Module'. Due to the specialist nature of this peripheral function it is not directly supported by Flowcode - though all the other general purpose features are.
Flowcode flowcharts are converted to equivalent C programs before being compiled and downloaded to the target devices. The C icon in Flowcode allows C code (and assembler code) to be written directly to the final C file.
In the case of the Encoder2.fcf program there are three C blocks, before the main loop, that are used to configure and initialise the Motion Feedback Module by writing directly to the relevant registers within the device.
A C code block within the main program loop is used to continually read the encoder count as two 8-bit values and transfer them back to Flowcode as a 16-bit integer.
This code will not simulate because Flowcode has no knowledge of the Motion Feedback Module. But the program does run on the target device with Flowcode directly controlling all the other operations.
This is probably not the best program to be used as an introduction to Flowcode, as it uses some advanced features, but I think it is close to being a solution to your application. Tracking encoder signals is not a trivial application unless low frequency operation can be guaranteed.
The current program has no reset button and displays the encoder position as a raw count value. It should be relatively easy to add a reset button and convert the display value to indicate degrees.
If you can let me know the resolution of your encoder in terms of pulses per degree of arm movement I might be able to modify the program for you.
Flowcode flowcharts are converted to equivalent C programs before being compiled and downloaded to the target devices. The C icon in Flowcode allows C code (and assembler code) to be written directly to the final C file.
In the case of the Encoder2.fcf program there are three C blocks, before the main loop, that are used to configure and initialise the Motion Feedback Module by writing directly to the relevant registers within the device.
A C code block within the main program loop is used to continually read the encoder count as two 8-bit values and transfer them back to Flowcode as a 16-bit integer.
This code will not simulate because Flowcode has no knowledge of the Motion Feedback Module. But the program does run on the target device with Flowcode directly controlling all the other operations.
This is probably not the best program to be used as an introduction to Flowcode, as it uses some advanced features, but I think it is close to being a solution to your application. Tracking encoder signals is not a trivial application unless low frequency operation can be guaranteed.
The current program has no reset button and displays the encoder position as a raw count value. It should be relatively easy to add a reset button and convert the display value to indicate degrees.
If you can let me know the resolution of your encoder in terms of pulses per degree of arm movement I might be able to modify the program for you.
Re: New user help !
Sean,
Thanks for the reply. Yes I agree that this is not the best thing for me right now. I will figure out the encoder pulses and get back to you. I would really appreciate your help on this as I need to get this project going and this is the part that is slowing things up. I am sure that once I see how you modified the code that i would understand whats going on with the code a little more. While I have your attention do you know of anyone that has used the mikroelectronika easy pic 5 development board with flow code. I know that I can burn the chip via the hex file thru a JDM programmer but I woundered if there has been any success with burning directly to the pic 5 board. Once again thanks for your help.
J Walthall
Thanks for the reply. Yes I agree that this is not the best thing for me right now. I will figure out the encoder pulses and get back to you. I would really appreciate your help on this as I need to get this project going and this is the part that is slowing things up. I am sure that once I see how you modified the code that i would understand whats going on with the code a little more. While I have your attention do you know of anyone that has used the mikroelectronika easy pic 5 development board with flow code. I know that I can burn the chip via the hex file thru a JDM programmer but I woundered if there has been any success with burning directly to the pic 5 board. Once again thanks for your help.
J Walthall
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: New user help !
Hello
The details of the JDM programmers command line options are available from here.
http://www.grennan.com/picprog/
You should be able to change the compiler options (Chip -> Compiler Options) in Flowcode to directly use the JDM programmer rather then our PPP programming tool.
The details of the JDM programmers command line options are available from here.
http://www.grennan.com/picprog/
You should be able to change the compiler options (Chip -> Compiler Options) in Flowcode to directly use the JDM programmer rather then our PPP programming tool.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: New user help !
Hi sean,
Here is what I have . If I use a 720 CPR encoder I will have 2 pluses per deg. I will then need the display to read 00.0 to 99.9 . I would also need some guidance on how to reset the display to zeros with a button on an input pin. Also I am unclear of the input pins for the encoder.This is a big help for this project. Thanks again for the help.
Regards,
JWalthall
Here is what I have . If I use a 720 CPR encoder I will have 2 pluses per deg. I will then need the display to read 00.0 to 99.9 . I would also need some guidance on how to reset the display to zeros with a button on an input pin. Also I am unclear of the input pins for the encoder.This is a big help for this project. Thanks again for the help.
Regards,
JWalthall
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: New user help !
Here is a version of the encoder program that might suit your application. I have configured the encoder interface to to match a 720 pulse/channel/rev encoder (2880 quadrature transitions). This will not provide sufficient resolution to give full 0.1 degree resolution, so I have set the display to count in 0.5 degree increments.
A momentary +ve pulse on the A0 iniput (lasting longer than 50ms) will reset the count to zero. This pin can be changed easily.
I can not test this program at the moment, but would be interested to recieve your feedback if you want to try it, or just review the code.
A momentary +ve pulse on the A0 iniput (lasting longer than 50ms) will reset the count to zero. This pin can be changed easily.
I can not test this program at the moment, but would be interested to recieve your feedback if you want to try it, or just review the code.
Re: New user help !
Sean,
Sorry for the delayed reply as I have been out and not able to check this forum. Thanks for the code this helps a bunch!!
Regards,
J Walthall
Sorry for the delayed reply as I have been out and not able to check this forum. Thanks for the code this helps a bunch!!
Regards,
J Walthall