COM1 and STANDBY COM1 : 7 Segment Display
-
- Posts: 3
- Joined: Wed Jan 18, 2023 1:35 pm
COM1 and STANDBY COM1 : 7 Segment Display
Hello Sim Innovations Team,
I have one question regarding the use of 7 digits segment display.
If I select one frequency with "5" in the end, like "119.405" ,and, after that, I select the frequency "118.400", The SIM Var is, unfortunately changed to "118.4" and not to "118.400". the tostring() converts the output to "118.4" (not completing the zeros missing) and the 7 segment Display displays: "118.405" (with the 05 "not updated from the last selected sequence").
Is there any solution that you already use for this problem?
Thank you in advance,
Lucas Godoy
I have one question regarding the use of 7 digits segment display.
If I select one frequency with "5" in the end, like "119.405" ,and, after that, I select the frequency "118.400", The SIM Var is, unfortunately changed to "118.4" and not to "118.400". the tostring() converts the output to "118.4" (not completing the zeros missing) and the 7 segment Display displays: "118.405" (with the 05 "not updated from the last selected sequence").
Is there any solution that you already use for this problem?
Thank you in advance,
Lucas Godoy
Re: COM1 and STANDBY COM1 : 7 Segment Display
Please see our wiki:
https://siminnovations.com/wiki/index.p ... _now_works!
So in your case for example string.format("%07.03f", frequency)
https://siminnovations.com/wiki/index.p ... _now_works!
So in your case for example string.format("%07.03f", frequency)
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: COM1 and STANDBY COM1 : 7 Segment Display
Hi,
Firstly, what 7 seg display are you using and how is it wired?
For a max7219 8 digit display you would have to format the string something like this. But that depends on the display and shift register.
string.format("% 9.03f",(com1act/1000))
The string format forces % 9 digits which includes the decimal. the .03f forces 3 decimal places.
Keith
Firstly, what 7 seg display are you using and how is it wired?
For a max7219 8 digit display you would have to format the string something like this. But that depends on the display and shift register.
string.format("% 9.03f",(com1act/1000))
The string format forces % 9 digits which includes the decimal. the .03f forces 3 decimal places.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: COM1 and STANDBY COM1 : 7 Segment Display
Depends indeed on which module you use. But you can also just add a few spaces, depending on where you want the frequency.
Example for a 8 character display and two spaces 'in front': string.format(" %07.03f", frequency)
Example for a 8 character display and two spaces 'in front': string.format(" %07.03f", frequency)
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: COM1 and STANDBY COM1 : 7 Segment Display
Hi,
We have to be careful with string.format() when it comes to 7seg displays.
The code you quoted assumes a LEFT address.
What happens if the value is 23.005 instead of 123.005
23.005 would return 023.005 + two white spaces addressed to the left most digit.
What you will find when running this simple code is the difference as to what the 0 and white-space. The string.format("%07.03f"forces a left align and will leave white-spaces after the three decimals, whereas string.format("% 7.03f") forces a right align but only to the 6th digit.
To force a right align on a 8 digit max7219 you must use string.format("% 9.03f")
Code: Select all
value = 123.005
com2_val = string.format("%07.03f", value)
print(com2_val )
value4 = 23.005
com2_val4 = string.format("%07.03f", value4)
print(com2_val4)
value2 = 123.005
com2_val2 = string.format("% 7.03f", value2)
print(com2_val2 )
value3 = 123.005
com2_val3 = string.format("% 9.03f", value2)
print(com2_val3 )
value5 = 23.005
com2_val5 = string.format("%09.03f", value5)
print(com2_val5)
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: COM1 and STANDBY COM1 : 7 Segment Display
You can either align left or right, depending on where you put the spaces, I don't really see the problem there.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: COM1 and STANDBY COM1 : 7 Segment Display
Hi,
The problem is understanding the formatting and how the max7219 (common one) will display the characters on the display.
I have beaten this dead horse so much that my whip is in bits and I cannot even make tasty pies out of what is left of the meat. it seams no-one is grasping what I am saying.
I will do a illustration tomorrow and post here.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: COM1 and STANDBY COM1 : 7 Segment Display
I know what you mean. But 99.99% is using that 8 segment MAX7219 thing, so there's not much to worry about.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: COM1 and STANDBY COM1 : 7 Segment Display
Hi,
I am working on a instrument that will give insight as to what formatting has on a MAX7219 (common) display.
There will be a variety of format criteria and different string options.
More on this later. Just a teaser of what is to come. Not the difference between these two string.format() 's and what is displayed.
Keith
I am working on a instrument that will give insight as to what formatting has on a MAX7219 (common) display.
There will be a variety of format criteria and different string options.
More on this later. Just a teaser of what is to come. Not the difference between these two string.format() 's and what is displayed.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 3
- Joined: Wed Jan 18, 2023 1:35 pm
Re: COM1 and STANDBY COM1 : 7 Segment Display
I would like to thank you all for the replies. It really helped me a lot with my issue.
Best Regards,
Lucas Godoy
Best Regards,
Lucas Godoy