Hi,
Is their any way to use the four digit seven segment component code available in flowcode for my five digit seven segment application?
Thanks
Kumaran
Programing 5 digit seven segment device
- 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: Programing 5 digit seven segment device
Hello Kumaran
My advice would be to have a look at the "LED7SEG4_Code.c" file located inside the Flowcode V3/Components directory.
You should be able to edit this file to allow for an extra hardcoded enable line to be implemented.
Have a go and see how far you get. Try and see what each line of code is doing to gain understanding of what you will have to change.
If you get stuck then let me know and I will lend a hand.
My advice would be to have a look at the "LED7SEG4_Code.c" file located inside the Flowcode V3/Components directory.
You should be able to edit this file to allow for an extra hardcoded enable line to be implemented.
Have a go and see how far you get. Try and see what each line of code is doing to gain understanding of what you will have to change.
If you get stuck then let me know and I will lend a hand.
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: Programing 5 digit seven segment device
As you sugested, I went in to the file. I tried changing following line so that I thought I will get extra digit
if (Digit >= 0 && Digit <= 4) & rom char* cCommonArray = {0x20, 0x10, 0x08, 0x04, 0x02}; but there is no effect. I guess I have to change something in this line MX_7SEG1_COMMON_PORT = (MX_7SEG1_COMMON_PORT & %o) | cCommonArray[Digit];
Could you please help me?
is it possible first?
Thanks in advance.
Kumaran
if (Digit >= 0 && Digit <= 4) & rom char* cCommonArray = {0x20, 0x10, 0x08, 0x04, 0x02}; but there is no effect. I guess I have to change something in this line MX_7SEG1_COMMON_PORT = (MX_7SEG1_COMMON_PORT & %o) | cCommonArray[Digit];
Could you please help me?
is it possible first?
Thanks in advance.
Kumaran
Re: Programing 5 digit seven segment device
I got struck. Can you help? first of all, can I edit like this to have additional digit?
Thanks in advance
Kumaran
Thanks in advance
Kumaran
- 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: Programing 5 digit seven segment device
Hello Kumaran
Ok I have modified the code file for you and the 5th 7 segment should now work. I have had to hard code the enable pin so if you are using bit 4 of the enable port as your 5th enable then you shouldb't have any problems. If you are using a different enable pin then you will need to edit the following lines of code.
Sets pin 4 of the enable port to an output, Change 0xEF so that your enable pin is the only 0 in the 8-bit value.
Sets pin 4 of the enable port high, Change 0x10 so that your enable pin is the only 1 in the 8-bit value
Sets pin 4 of the enable port low, Change 0x10 so that your enable pin is the only 1 in the 8-bit value
If you want the enable pin to be on a different port from the other pins then you will have to do a bit more editing of the code file to allow for the extra port to be used.
Let me know how you get on.
Ok I have modified the code file for you and the 5th 7 segment should now work. I have had to hard code the enable pin so if you are using bit 4 of the enable port as your 5th enable then you shouldb't have any problems. If you are using a different enable pin then you will need to edit the following lines of code.
Sets pin 4 of the enable port to an output, Change 0xEF so that your enable pin is the only 0 in the 8-bit value.
Code: Select all
MX_7SEG1_COMMON_TRIS = MX_7SEG1_COMMON_TRIS & 0xEF;
Code: Select all
MX_7SEG1_COMMON_PORT = (MX_7SEG1_COMMON_PORT & %o) | 0x10
Code: Select all
MX_7SEG1_COMMON_PORT = (MX_7SEG1_COMMON_PORT | ~%o) & ~0x10;
Let me know how you get on.
- Attachments
-
- LED7SEG4_Code.c
- (5.16 KiB) Downloaded 332 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: Programing 5 digit seven segment device
I have downloaded your attachment code file and copied in to the components directory. since it cannot be simulated in flowcode. I have created a simple ciruit in proteus to check the code (The circuit snapshot is attached). But the 5th digit did not work. if you see it has not changed as output pin. I have viewed the c code generated in the flowcode to check whether the new code taken effect. every thing is ok their.
- Attachments
-
- 5Digit.zip
- (152.18 KiB) Downloaded 374 times
- 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: Programing 5 digit seven segment device
Hello
Ok it looks like the pin is not being converted to an output correctly. Please can you try this code file and see if this fixes the problem your having. Also on some devices pin RA4 is an open collector output so it cannot source current. Try providing a 1K pullup resistor in proteus between RA4 and 5V if my ammended code file does not help.
Ok it looks like the pin is not being converted to an output correctly. Please can you try this code file and see if this fixes the problem your having. Also on some devices pin RA4 is an open collector output so it cannot source current. Try providing a 1K pullup resistor in proteus between RA4 and 5V if my ammended code file does not help.
- Attachments
-
- LED7SEG4_Code.c
- (5.17 KiB) Downloaded 293 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: Programing 5 digit seven segment device
Thanks for your extra ordinary support. I could not imagine how much time it could have taken if I would have not seek your support.
I have tried your amended code. but in this code also same problem appeared. I understand that it is not getting driven as output with component code. So I added extra flowcode blocks, that is output blocks with zero initialization for whole port in the beginning of the program and after the call for the fifth digit with only 4th pin to zero.It worked well. I have implemented the circuit changes as per your suggestion. I have attached the images of the circuit and the code diagram for the readers.
Thanks
Kumaran
I have tried your amended code. but in this code also same problem appeared. I understand that it is not getting driven as output with component code. So I added extra flowcode blocks, that is output blocks with zero initialization for whole port in the beginning of the program and after the call for the fifth digit with only 4th pin to zero.It worked well. I have implemented the circuit changes as per your suggestion. I have attached the images of the circuit and the code diagram for the readers.
Thanks
Kumaran
- Attachments
-
- Modified_Circuit.png
- (124.79 KiB) Downloaded 2136 times
-
- Fifth_Digit_Code.png
- (113.61 KiB) Downloaded 2134 times