How can I use a Led7Seg() on PORT B1..B7 (DP unconnected !) and at the SAME TIME use RB0INT for interrupt.
I beleave the ShowDigit() method do NOT use "masking" when "writing" to the PORT B1..B7.
I use PIC16F628 4 X Led7Seg() and multiplexing and common cathode - I only mis this interrupt on RB0.
How can this be done ?
Led7Seg() on PORT B and RB0INT ?
Moderator: Benj
- 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: Led7Seg() on PORT B and RB0INT ?
Hello Ksor
The only way to get rid of the decimal point is currently to modify the C code file so that the port is not modified when outputting the segment control values.
You can modify the C code by using the code customization feature in Flowcode v4. Simply select the component and then click on the Custom Code button.
The line
MX_7SEG4_SEGMENT_TRIS = MX_7SEG4_SEGMENT_TRIS & %p;
Becomes
MX_7SEG4_SEGMENT_TRIS = (MX_7SEG4_SEGMENT_TRIS & %p) | 0x01;
You should now be able to enable the RB0 interrupt and the interrupt should then work correctly to fire the service macro.
If you are using the 7seg1 instead of the 7seg4 then let me know and I will let you know the lines of code you will need to edit.
The only way to get rid of the decimal point is currently to modify the C code file so that the port is not modified when outputting the segment control values.
You can modify the C code by using the code customization feature in Flowcode v4. Simply select the component and then click on the Custom Code button.
The line
MX_7SEG4_SEGMENT_TRIS = MX_7SEG4_SEGMENT_TRIS & %p;
Becomes
MX_7SEG4_SEGMENT_TRIS = (MX_7SEG4_SEGMENT_TRIS & %p) | 0x01;
You should now be able to enable the RB0 interrupt and the interrupt should then work correctly to fire the service macro.
If you are using the 7seg1 instead of the 7seg4 then let me know and I will let you know the lines of code you will need to edit.
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: Led7Seg() on PORT B and RB0INT ?
Yes, I am using 4 X Led7Seg1() (so I can get a unit with common cathode)
I think it's stange that leaving the DP unconnected should have the sideeffect that the RB0INT could'n't be used but I'll try.
But pleace tell me witch lines to change.
I think it's stange that leaving the DP unconnected should have the sideeffect that the RB0INT could'n't be used but I'll try.
But pleace tell me witch lines to change.
Best regards
KSor, Denmark
KSor, Denmark
Re: Led7Seg() on PORT B and RB0INT ?
Oh - I beleave I found it - the one with thw "1" instead of the "4" - right ?
Best regards
KSor, Denmark
KSor, Denmark
- 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: Led7Seg() on PORT B and RB0INT ?
Hello Ksor
The line is in the ShowDigit function and looks like this.
MX_7SEG1_SEGMENT_TRIS = MX_7SEG1_SEGMENT_TRIS & %p;
Change this to
MX_7SEG1_SEGMENT_TRIS = (MX_7SEG1_SEGMENT_TRIS & %p) | 0x01;
The interrupt is current uncompatible because the 7-segment component converts the pins connected to the segments to outputs. The modification to the code is stopping pin 0 of the segment port from being converted into an output.
Remember you will have to make this mod to each 7seg1 component if you are using the code customisation. Otherwise if you want to make the mod static for all 7seg1 components in future then you can edit the 7seg1 component C code file directly.
The line is in the ShowDigit function and looks like this.
MX_7SEG1_SEGMENT_TRIS = MX_7SEG1_SEGMENT_TRIS & %p;
Change this to
MX_7SEG1_SEGMENT_TRIS = (MX_7SEG1_SEGMENT_TRIS & %p) | 0x01;
The interrupt is current uncompatible because the 7-segment component converts the pins connected to the segments to outputs. The modification to the code is stopping pin 0 of the segment port from being converted into an output.
Remember you will have to make this mod to each 7seg1 component if you are using the code customisation. Otherwise if you want to make the mod static for all 7seg1 components in future then you can edit the 7seg1 component C code file directly.
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: Led7Seg() on PORT B and RB0INT ?
Yeah - I found out and it's working fine !
It would be nice if the component only controls the bits connected to the component and not the whole port.
And NOT connecting the DP or another segment SHOULD be the only thing for user to do for "leaving out the segment"!
- maybe in the next update ?
It would be nice if the component only controls the bits connected to the component and not the whole port.
And NOT connecting the DP or another segment SHOULD be the only thing for user to do for "leaving out the segment"!
- maybe in the next update ?
Best regards
KSor, Denmark
KSor, Denmark
- 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: Led7Seg() on PORT B and RB0INT ?
Hello Ksor,
Great thanks for letting me know.
Yes thats a nice idea, however the addition of swapping in and out pins may make the code a bit more bulky.
Eg instead of a single 8-bit write to the port there is now an individual write for every pin that is present.
Its always hard to balance functionality and performance, however I will see if this is something we can add to the list for version 5.
Great thanks for letting me know.
Yes thats a nice idea, however the addition of swapping in and out pins may make the code a bit more bulky.
Eg instead of a single 8-bit write to the port there is now an individual write for every pin that is present.
Its always hard to balance functionality and performance, however I will see if this is something we can add to the list for version 5.
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