Matrix _16f877 need help, please


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Apr 2008
    Posts
    85

    Default Matrix _16f877 need help, please

    Currently i write a code to run a led matrix. the following is a one led set to be lighted up. the positive pin of the LED is connected to port B0. and negative, to port C1.

    the X-tal OSC is 20Mhz, HS_osc is placed in the 16F877.INC file; OSC. set to HS
    MCLR is connected directly to the 5V source.

    i use PBP
    -----------------------
    ; 16F877A

    ADCON1 = 7

    A VAR BYTE

    PORTB = 0 ; SET PORTB AS OUTPUT
    PORTC = 0 ; set port c as output

    PORTC.1 = 0 ; set port C1 to low

    pause 300
    LOOP:

    FOR A = 0 TO 8 loop to repeat

    PORTB.0 = 1 set port B0 to high
    PAUSE 500

    PORTB.0 = 0 ; set port B0 to low
    PAUSE 300

    NEXT A

    GOTO LOOP
    END

    -------------------------

    the Voltage measurement on the two pins of the LED is 1.65V!!!!!!!

    something wrong!!!!!!!!!!

    any help from you i do appreciate, thanks

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi MINHLE,
    try this
    Code:
    ADCON0 = 0
    ADCON1 = 7
    
    A VAR BYTE
    
    PORTB = 0 ; SET PORTB AS OUTPUT
    PORTC = 0 ; set port c as output
    trisB = %00000000 'all ports B as outputs
    TrisC = %00000000 'all ports C as outputs
    
    PORTC.1 = 0 ; set port C1 to low wich enables leds ground pin
    CCP1CON = 0 ' turn off CCP Module which affects portC
    pause 300
    
    LOOP:
    FOR A = 0 TO 8 'loop to repeat
    PORTB.0 = 1 'set port B0 to high, turn on led
    PAUSE 500
    PORTB.0 = 0 ; set port B0 to low, turn off led
    PAUSE 300
    NEXT A
    
    GOTO LOOP ' Flash forever
    END
    The only difference is I set Tris registers and disabled Capture Compare Module. and turned off A/D converter. Now how have you set your config fuses? You have specified 20 mhz and this will not work with the default config statement found in the C:\PBP\16f877.inc file.
    Last edited by Archangel; - 5th February 2009 at 03:17.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    THANKS jOE,

    I TRY AGAIN AS YOUR SUGGESTION.

    I WILL SET THE OSC TO 20MHZ, AND CHECK THE DATA SHEET

    THANKS

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    In case you change XT to HS osc in your .inc file, make sure you've made the change for the right assembler... this is 1 reason why I set my fuses in code, not in the .INC file.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    hi, Joe and Steve,
    thanks for your concern. I tried testing but no thing happen. is it possible the two capacitors of the osc-xtal is the main problem.

    I saw in the data sheet, for the Hs (20Mhz) xtal osc, the capacitors are range 15-33pF. but i use only 10uF! (table 14-2 page 144 of the data sheet).

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MINHLE View Post
    hi, Joe and Steve,
    thanks for your concern. I tried testing but no thing happen. is it possible the two capacitors of the osc-xtal is the main problem.

    I saw in the data sheet, for the Hs (20Mhz) xtal osc, the capacitors are range 15-33pF. but i use only 10uF! (table 14-2 page 144 of the data sheet).
    µ is Way bigger than pf Way too big !10µF will oscillate in kilohertz, not mhz.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    thanks, I should replace them tomorrow.

  8. #8
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    MINHLE, What exactly is the question? Are you concerned that the voltage across the led is too low? What is the value of the resistor in series with the led? Do you have any resistor in series with the led at all? If there is no resistor in series with the led then the current is too great for the PIC and the voltage is being dropped too low for the oscillator to operate... What is the voltage across the 2 PIC pins you are using to drive the led? You should start out with maybe a 680 Ohm resistor in series with the led and see if that doesnt cure the problem...

    Dave Purola,
    N8NTA

  9. #9
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,


    thanks for your concern,

    the voltage drop across the LED is an important issue here. if the voltage different across the LED is '0" then the LEd cannot be lighted up. a resistor in serial with the LED is to protect the LED when the high pulse current flowing through the LEd aND TO PROTECT THE PIC FROM HIGH IN PUT CURENT . so we do have to consider the voltage drop on the resistor.

    in this case the positive pin of the LED is 1.65V, then the negative pin of the LED has to be '0' as set up. however the situation different, both side of the LED is 1.65 so it means that either open circuit (no current flowS through the LED) , the bad PIC or the program not well set up( i.e conf, ...).

    I wish getting some suggestion , ideal from you,

    thank agian

  10. #10
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Since you didn't use a limiting resistor, you have fried the pic!
    Replace it and put a 330 ohms resistor in series to every leds. Then use Joe snippet, given in post # 2 and you will see that leds will switch on and off without burning another pic.
    You will always read 1.6 - 1.7 V across a led, unless you have shorted one!

    Al.
    Last edited by aratti; - 7th February 2009 at 17:31.
    All progress began with an idea

  11. #11
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default

    hello Arrati,

    yes I have 200 ohms resistors connected in serial with each input of the PIC to limit the current into the pic.

    I guest some thing wrong, because when I use OHM meter to test the LEDs. at the two pins on the socket (removing the PIC out of the socket) every thing is ok! so the circuit is not open.

    I try to figure out

    thanks for your comment.

    Minh le

  12. #12
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Red face

    hi every boDy,

    I removed the two capacitors of the X-TAL OSCILLATOR then it works. i am sorry for long time not to post the reply

Similar Threads

  1. led matrix pic 16f84 and 4017 help me please
    By Mus.me in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 5th February 2011, 00:06
  2. RGB LED Matrix
    By ERIK in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th June 2008, 07:01
  3. LED Matrix Question
    By mekohler in forum Schematics
    Replies: 28
    Last Post: - 29th September 2007, 13:12
  4. 4x16 Dot Matrix LCD control is possible?
    By muskut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st September 2005, 09:56
  5. need help with switch matrix
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th January 2005, 18:59

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts