Page 1 of 1

16f88 / 16f628 int b0 with 7segment on port b

Posted: Wed Aug 29, 2012 11:13 am
by asbase
I connect a button to int b0 for interrupt and 4 digit 7 segment led on b1-b7 for segment a-g and leave dot segment unconnect.
I found the flowcode simulator work properly but not in real hardware. Please advice.

Re: 16f88 / 16f628 int b0 with 7segment on port b

Posted: Wed Aug 29, 2012 11:30 am
by DavidA
Hello,

Please see this post from Martin about issues with hardware.

http://www.matrixmultimedia.com/mmforum ... =26&t=6936

Also if you still have problems, you will need to be a bit more descriptive about your problem, ie, what version of Flowcode you use, what chip you are programming, what the target hardware is (Eblocks? Arduino? Custom hardware?), also other details like clock speed etc.

A good practice is to do a 1s flasher program to ensure your clock speed is correct.

Re: 16f88 / 16f628 int b0 with 7segment on port b

Posted: Wed Aug 29, 2012 11:40 am
by Enamul
It's happening because in 7 segment component code is written in this way that whole port is for 7 segment 0-7 bit sequentially. Have you noticed in simulation whether you put 0 or 1 in decimal point but dp always on...
This is because of array declared in the c code..

Code: Select all

ROMARRAY_S SEVENSEG4_1_SegmentArray ROMARRAY_E = {192, 249, 164, 176, 153, 146, 130, 248, 128, 152};        //Create ROM pattern array for the display

Re: 16f88 / 16f628 int b0 with 7segment on port b

Posted: Wed Aug 29, 2012 2:09 pm
by Enamul
Hi,
Although my last post wasn't not wrong but there is no solution there. I have tried to test your problem in single segment as the case is same for single and 4 segment. But testing is easier in single segment.. I got the problem...Actually although you left DP unconnected but FC doesn't leave it unconnected..proof is..

Code: Select all

#define SEVENSEG1_1_SEG_PORT        portb
#define SEVENSEG1_1_SEG_TRIS        trisb
#define SEVENSEG1_1_COM_PORT        porta
#define SEVENSEG1_1_COM_TRIS        trisa
#define SEVENSEG1_1_SEG_PIN0        1
#define SEVENSEG1_1_SEG_PIN1        2
#define SEVENSEG1_1_SEG_PIN2        3
#define SEVENSEG1_1_SEG_PIN3        4
#define SEVENSEG1_1_SEG_PIN4        5
#define SEVENSEG1_1_SEG_PIN5        6
#define SEVENSEG1_1_SEG_PIN6        7
#define SEVENSEG1_1_SEG_PIN7        7
#define SEVENSEG1_1_COM_PIN        0
#define SEVENSEG1_1_COM_TYPE        0
you see both 6 and 7 pin connected to bit 7...that causing the problem and the solution is you have to edit your component code...
First of all..as you are not using DP..disable that code...

Code: Select all

//    if (DecimalPoint)
        //    cSegmentValue = cSegmentValue & 0x7F;            //Clear decimal point bit
If you put decimal point as 0 this bit of code is normally ignored...but for safety disable this..
But the main problem is causing by..

Code: Select all

//        if (cSegmentValue & 0x80)
    //        {
    //            FC_CAL_Bit_High_DDR(SEVENSEG1_1_SEG_PORT, SEVENSEG1_1_SEG_TRIS, SEVENSEG1_1_SEG_PIN7);
    //        }
    //        else
    //        {
    //            FC_CAL_Bit_Low_DDR(SEVENSEG1_1_SEG_PORT, SEVENSEG1_1_SEG_TRIS, SEVENSEG1_1_SEG_PIN7);
    //        }
Disable this portion of code...
and also

Code: Select all

  //        if (cSegmentValue & 0x80)
    //        {
    //            FC_CAL_Bit_Low_DDR(SEVENSEG1_1_SEG_PORT, SEVENSEG1_1_SEG_TRIS, SEVENSEG1_1_SEG_PIN7);
    //        }
    //        else
    //        {
    //            FC_CAL_Bit_High_DDR(SEVENSEG1_1_SEG_PORT, SEVENSEG1_1_SEG_TRIS, SEVENSEG1_1_SEG_PIN7);
    //        }}
I am posting here new c code for component 7seg...you have to backup your own in the component folder of FCV5 and use the attached one..If you get this one nice and working, you can edit your 4segment component or tell me to do that.

Re: 16f88 / 16f628 int b0 with 7segment on port b

Posted: Sun Sep 02, 2012 7:08 pm
by jgu1
Hi Enamuel!

This 7seg.c is this a fix for 5.4 wich you recommend to update :?:
Hope I'm not too irritating and asking to much, otherwise tell me. But I want to have the perfect FC as possible. I am not able to look deeper into the "stomach" of FC as you are. I am only a user of FC. .

Best regard

Jorgen

Re: 16f88 / 16f628 int b0 with 7segment on port b

Posted: Sun Sep 02, 2012 7:22 pm
by Enamul
Hi Jorgan,
No problem in asking. You are always welcome. No this is not general fix. It is for those who want to use 7segment in portb from 1 to 7 and bit 0 for other purpose and they will not use dp.. As currently you have to connect a,b,c,d,e,f,g,dp in bit 0-7.

Re: 16f88 / 16f628 int b0 with 7segment on port b

Posted: Sun Sep 02, 2012 7:34 pm
by jgu1
Hi ,hi, you are quickly Enamuel, Ok I understand - Thank“s :D

Jorgen