Menu

TM1637 6 digit with PIC16f877A

AB
2025-05-13
2025-05-24
1 2 3 > >> (Page 1 of 3)
  • AB

    AB - 2025-05-13

    Hi Everyone.
    I am sure the solution to this issue is simple, but I just can't get there. I have read a lot in the forum plus also on line and do not understand why my programme does not work.
    Here goes:
    1) When i compile the arduino file for mega328p - the TM1637 works perfectly.
    2) When i change the chip (and relevant ports) to 16F877A, TM1637 does not work - nothing shows on the digits.

    Oscilloscope shows activity on the data and clock lines - but no activity on the TM1637

    I have set the fuses to use the crystal and again the oscilloscope shows that this is working. I have tested using a different 16f877a with the same result.

    As i mentioned - i am sure i am missing something obvious so any waise suggestions would be appreciated
    Thanks
    Alan

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    Try adding a delay before sending the first number. Something like: wait 500ms

     
  • AB

    AB - 2025-05-13

    yeah i tried that. I gave it 2 seconds before writing to the module but it made no difference.

    Thx for the suggestion :-)

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    Try adding:
    dir PORTB.6 out
    dir PORTB.7 out

    No idea if it makes a difference, since you already have a signals on the pins.

     

    Last edit: Roger Jönsson 2025-05-13
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    Are you sure that you should not instead use: #include <TM1637a.h>

     

    Last edit: Roger Jönsson 2025-05-13
  • AB

    AB - 2025-05-13

    adding DIR made no difference
    .
    If i use tm1637a.h then gcbasic does not recognise TMWrite6Dig
    From the documentation- TM1637-6d.h is for the 6 digit model - which is what i am using
    ie GCbasic will not compile it

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    I see that TM1637-6d.h is mentioned in a discussion on this forum, but the help doc online and all the examples I could find are for the 4 digit display and use tm1637a.h
    In which documentation did you find TM1637-6d.h ?
    Please ping back when and if you get it to work. I have been thinking of getting and using one of these 6 digit displays...

     
  • AB

    AB - 2025-05-13

    it works fine when using arduino. But i can't duplicate using Microchip IC's
    Here is the link to the documentation

    https://gcbasic.sourceforge.io/help/_7_segment_displays_tm1637_6_digits.html

    Thx for helping cos its driving me nuts trying to get it to work with microchip :-(

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    That documentation example use include <TM1637a.h> combined with TMWrite6Dig
    (sending only 4 digits) so I guess it may not be 100% correct.

     

    Last edit: Roger Jönsson 2025-05-13
  • AB

    AB - 2025-05-13

    also - using the tm1637a.h and changing the write command to TMWrite4Dig did not work either
    The oscilloscope shows the data on the clk and dat lines but nothing on the display

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    Maybe you are the first one to actually test the tm1637 6digit with GC basic...

     
  • AB

    AB - 2025-05-13

    ha ha ha - looks thats way. Anyway its above my paygrade cos i can't work it out :-(

     
  • Anobium

    Anobium - 2025-05-13

    Hello, it works with the mega328p then it should work.

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    Running everything on the same voltage?

     
  • AB

    AB - 2025-05-13

    same voltage - 5v battery pack. And i know it seems weird but does not run on a microchip
    I also tried a 16f628a (i did not forget to use a 10k pull up resistor to 5V on MCLR)
    Happy for any crazy suggestions

     
  • AB

    AB - 2025-05-13

    i even used an inverter on the dat and clk lines (individually as well)
    Made no difference - yes i was clutching at straws

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    Do you have a 4 digit one to test with?

     
  • AB

    AB - 2025-05-13

    nope

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-13

    @Anobium While on the subject. The documentation example use include <TM1637a.h>combined with TMWrite6Dig. Is that correct?
    (TM1637_6d.h is not mentioned)
    https://sourceforge.net/p/gcbasic/discussion/629990/thread/de80c6381a/

     

    Last edit: Roger Jönsson 2025-05-13
  • AB

    AB - 2025-05-13

    from what i understand reading the docs is that tm1637a.h is for the 4 digit display and the tm1637_6d is for the 6 digit display. They are not interchangeable.
    the example for 6 digit display uses TMWrite6Dig to write to the display and this only works with the tm1637_6d library.
    if you look at the attachments in my first message, you will see the programme that works on arduino. All i changed was the chip and the ports for the 16f877a and then compiled it.
    And as i mentioned nothing shows on the display. Oscilloscope show activity on the clk and data lines as expected.
    thanks for helping - much appreciated

     
  • HackInBlack

    HackInBlack - 2025-05-14

    try adding ' TMchar_Bright = 10 ' this is mentioned in the first referenced docs 'without this the display is blank' maybe this is affecting the program? just maybe.
    i seem to have lost my 877A's to try it out.phooey...my board is a TM1638! no help here

     

    Last edit: HackInBlack 2025-05-14
  • AB

    AB - 2025-05-14

    just tried it - no luck. No activity on display.
    If you have one of these units - what other microchip ic's do you have to be able to try?
    I tried a 16f628a with the same results but i have some other ic's as well
    Weird that it works perfectly on Arduino

     
  • Roger Jönsson

    Roger Jönsson - 2025-05-14

    "Must be a bi-directional port." -Are there any pullups resistors for CLK and DIO?

     
  • AB

    AB - 2025-05-14

    just tried that - no change

     
1 2 3 > >> (Page 1 of 3)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.