Hi
I have the next little problem with the LED7SEG4(0) component. That is as follows.
The last digit lights brighter than the other digits, this depends on the timing.
To fix this problem I now use an output (port) to switch off the common from the led7segments(0), See Leddisplaytiming.
That works. But is it possible to change this in the C code from this component.
For example, start with digit 1 instead of digit zero, zero is then off.
The value 4 as digit has no effect. Without that, it could be a problem when bit 4 is used for something else.
How do I have to change this in the C code from this component.
Or is it better that it has to be changed by Matrix Multimedia.
Switch Off Led7Seg4(0)
Moderator: Benj
Switch Off Led7Seg4(0)
- Attachments
-
- LEDdisplay-timing.fcf
- Leddisplaytiming
- (5.5 KiB) Downloaded 318 times
Taurus
- 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: Switch Off Led7Seg4(0)
Hello Taurus
A good way of controlling the 7segs is to have a single control variable that is updated in your main program.
Then create a timer interrupt that will timeout every 5ms or so to switch off the previous character on the 7 segments and light the next character. You could use a global variable to count which character of the 7 segment you are up to and this way each character will be on for exactly the same amount of time (e.g. 1 interrupt timeout period). Also you will be able to do things like long delays etc in your main program without having to worry about getting back to update the 7seg display.
A good way of controlling the 7segs is to have a single control variable that is updated in your main program.
Then create a timer interrupt that will timeout every 5ms or so to switch off the previous character on the 7 segments and light the next character. You could use a global variable to count which character of the 7 segment you are up to and this way each character will be on for exactly the same amount of time (e.g. 1 interrupt timeout period). Also you will be able to do things like long delays etc in your main program without having to worry about getting back to update the 7seg display.
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: Switch Off Led7Seg4(0)
Thanks for your response.
Do you have a little sample of these, because I don’t understand it for now.
Ok, let’s say I did understand it, how could I switch off the display for example for energy save.
A second thing, why is it possible to switch off the single led7seg in that macro and not in the led7seg4(0).
Is it possible to use this option also for the led7seg4(0) component, please, tell me how I can changes this in custom C code from the component led7seg4(0).
Another thing, I did try to place 4 single digits on the panel, for the first three digits I did fill in the connections. But when I take a look at the properties from the fourth digit, then I get this error.
Run-time error ‘-2147418105(80010007)’:
Automation Error
Sorry I can’t repeat it for now. But maybe you can do something with it.
Please try this program and take a look what happens.
- On the PIC the led7seg(0) is not displaying.
- See what happens with the Led Arry on port B
I don’t understand it at all.
My compliments about the “articles” item in the forum, that is great.
Do you have a little sample of these, because I don’t understand it for now.
Ok, let’s say I did understand it, how could I switch off the display for example for energy save.
A second thing, why is it possible to switch off the single led7seg in that macro and not in the led7seg4(0).
Is it possible to use this option also for the led7seg4(0) component, please, tell me how I can changes this in custom C code from the component led7seg4(0).
Another thing, I did try to place 4 single digits on the panel, for the first three digits I did fill in the connections. But when I take a look at the properties from the fourth digit, then I get this error.
Run-time error ‘-2147418105(80010007)’:
Automation Error
Sorry I can’t repeat it for now. But maybe you can do something with it.
Please try this program and take a look what happens.
- On the PIC the led7seg(0) is not displaying.
- See what happens with the Led Arry on port B
I don’t understand it at all.
My compliments about the “articles” item in the forum, that is great.
- Attachments
-
- SingleLedError.fcf
- (13 KiB) Downloaded 317 times
Taurus
- 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: Switch Off Led7Seg4(0)
Hello Taurus
I have attached a simple example for you. The example should run and display each 7-segment display for 3ms. I have provided a mechanism for enabling and disabling the display and also for updating the count value from inside the main program.
If you do find a way to replicate the problem you had then please let us know and we will look into this for you.
Glad you are enjoying the articles we also enjoy writing them.
I have attached a simple example for you. The example should run and display each 7-segment display for 3ms. I have provided a mechanism for enabling and disabling the display and also for updating the count value from inside the main program.
If you do find a way to replicate the problem you had then please let us know and we will look into this for you.
Glad you are enjoying the articles we also enjoy writing them.
- Attachments
-
- 7Seg Example.fcf
- (8 KiB) Downloaded 369 times
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: Switch Off Led7Seg4(0)
Benj, thanks for your solution with the led7segment.
Question 1
This clears one of my problems, but it does not solve the problem that I have to use separate output ports. These ports I have to check now every time when I use the macro in other programs.
Again, how can I change this in the component led7seg4(0) C code, please!
Question 2
Please try the program SingleLedError.fcf above and take a look what happens (simulation).
I did place the led array to see what happens, because the led7seg didn’t display it with the PIC. Please tell me why!
If you don’t like to wait so long then make the loops shorter in the case but don’t remove them.
The best you can do is to make a breakpoint at portb=1 in case 1.
The led7seg displays no value.
Make a single step, now you will see that led b1 lights up, that’s ok
Next step, the led7seg displays the digit 4, that’s ok, but also the led-array displays the value byte 10011001. That is very strange!
We single step through the loop and come to the led7seg macro.
At the next single step the led7seg digit goes out and the led-array displays the value
byte 11111111. That is very strange too!
Can you tell me why this is going wrong.
Question 1
This clears one of my problems, but it does not solve the problem that I have to use separate output ports. These ports I have to check now every time when I use the macro in other programs.
Again, how can I change this in the component led7seg4(0) C code, please!
Question 2
Please try the program SingleLedError.fcf above and take a look what happens (simulation).
I did place the led array to see what happens, because the led7seg didn’t display it with the PIC. Please tell me why!
If you don’t like to wait so long then make the loops shorter in the case but don’t remove them.
The best you can do is to make a breakpoint at portb=1 in case 1.
The led7seg displays no value.
Make a single step, now you will see that led b1 lights up, that’s ok
Next step, the led7seg displays the digit 4, that’s ok, but also the led-array displays the value byte 10011001. That is very strange!
We single step through the loop and come to the led7seg macro.
At the next single step the led7seg digit goes out and the led-array displays the value
byte 11111111. That is very strange too!
Can you tell me why this is going wrong.
Taurus
- 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: Switch Off Led7Seg4(0)
Hello Taurus
1) The 7-Segment component uses two ports because you need 8 connections to the segments of the display(s) and other control lines to control the display address. How do you intend to change this?
2) Look at the connections for the fourth 7-segment in your program and you will see it is connected to portB instead of portD as used on the other displays. This is why the LED array is showing a strange pattern.
1) The 7-Segment component uses two ports because you need 8 connections to the segments of the display(s) and other control lines to control the display address. How do you intend to change this?
2) Look at the connections for the fourth 7-segment in your program and you will see it is connected to portB instead of portD as used on the other displays. This is why the LED array is showing a strange pattern.
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: Switch Off Led7Seg4(0)
Hi benj
Thanks, my fault.
Stupid, I thought that I did check everything, my girlfriend did ask me before I sent it to the forum, “did you check everything”.
That is also the reason why I would like to have it into the macro component.
My idea was, only to switch off the common lines from the Led-7seg4(0), because the other lines are all used for the digit value. I think the easy way to change this, is to use for the common digit 1,2,3,4 instead of 0,1,2,3. If now is filled in zero, then the display is off.
Another way is to make one more setting that switches off the common lines in the macro.
Just what you did in the single led7seg, but then for all digits.
What did you think about this?
By the way, thanks for your response on my mail today.
Thanks, my fault.
Stupid, I thought that I did check everything, my girlfriend did ask me before I sent it to the forum, “did you check everything”.
That is also the reason why I would like to have it into the macro component.
My idea was, only to switch off the common lines from the Led-7seg4(0), because the other lines are all used for the digit value. I think the easy way to change this, is to use for the common digit 1,2,3,4 instead of 0,1,2,3. If now is filled in zero, then the display is off.
Another way is to make one more setting that switches off the common lines in the macro.
Just what you did in the single led7seg, but then for all digits.
What did you think about this?
By the way, thanks for your response on my mail today.
Taurus