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

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
asbase
Posts: 20
Joined: Sun Jun 03, 2012 12:53 pm
Location: Malaysia
Has thanked: 13 times
Contact:

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

Post 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.

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

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

Post 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.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

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

Post 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
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

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

Post 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.
Attachments
7seg.fcf
(8 KiB) Downloaded 275 times
FC5_PIC_7seg.c
modified for pic16f628 with RB1-7
(7.85 KiB) Downloaded 270 times
Enamul
University of Nottingham
enamul4mm@gmail.com

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

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

Post 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

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

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

Post 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.
Enamul
University of Nottingham
enamul4mm@gmail.com

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

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

Post by jgu1 »

Hi ,hi, you are quickly Enamuel, Ok I understand - Thank´s :D

Jorgen

Post Reply