+ Reply to Thread
Page 2 of 6
First 1 2 3 4 5 6 Last
Results 16 to 30 of 77

Thread: Breadboard and my microcontroller.

  1. #16
    danielsmusic Newbie
    Join Date
    Jul 2005
    Location
    cheshire
    Posts
    457

    Default

    I'm not using a wall adapter, I'm using a battery (7AH sealed lead acid).

    Code:
    #include <system.h>
    #pragma DATA _CONFIG, _CP_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC
    
    
    void test(unsigned char data) //stolen from a website, I can't remember where now
    {
       unsigned char bits;
       for (bits=0x80; bits != 0; bits >>= 1)
       {
          if ((bits & data) == bits)  
          {     
              set_bit(portb,0);
          }
          else
          {
             clear_bit(portb, 0);
          }
          set_bit(portb, 1);   
          clear_bit(portb, 1);
       }
       set_bit(portb, 2);        
    	clear_bit(portb, 2);
    } 
    
    void main()
    {
    	trisb = 0;
    	portb = 0;
    	unsigned char f = 0;
    	
    	while(1)
    	{
    		toggle_bit(f, 5);
    		test(f);
    		delay_s(1);
    	} 
    }
    
    Last edited by danielsmusic; 10th December 2008 at 08:47 PM.
    when you post that reply, im just kidding.


  2. #17
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,744

    Default

    try:
    Code:
    void test(unsigned char data) //stolen from a website, I can't remember where now
    {
       unsigned char x;
       for (x=0;x<8;x++)
       {
          if (data & 0x80) != 0)
              set_bit(portb,0);
          else
             clear_bit(portb, 0);
    
          set_bit(portb, 1);
          clear_bit(portb, 1);\
    
          data=data<<1;
       }
       set_bit(portb, 2);        
       clear_bit(portb, 2);
    }
    
    Last edited by AtomSoft; 10th December 2008 at 08:56 PM.
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  3. #18
    danielsmusic Newbie
    Join Date
    Jul 2005
    Location
    cheshire
    Posts
    457

    Default

    Quote Originally Posted by AtomSoft View Post
    try:
    Code:
    void test(unsigned char data) //provided by atomsoft
    {
       unsigned char bits,x;
       for (x=0;x<8;x++)
       {
          if (data & 0x80) != 0)
              set_bit(portb,0);
          else
             clear_bit(portb, 0);
    
          set_bit(portb, 1);
          clear_bit(portb, 1);
       }
       set_bit(portb, 2);        
       clear_bit(portb, 2);
    }
    
    That would not work because you're only testing the 8th bit. The function I have works fine, I have tested all the LEDs in different combinations.
    when you post that reply, im just kidding.

  4. #19
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,744

    Default

    forgot the shift i see I fixed tho..

    So since it works fine whats the issue.
    Last edited by AtomSoft; 10th December 2008 at 08:57 PM.
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  5. #20
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default

    danielsmusic,
    You need at least 0.33uF on the input and 0.1uF on the output of the 7805 or it may become unstable. Put them as close as possible to the 7805. You should also have a 0.1uF close to the PICs power pins.
    Last edited by kchriste; 11th December 2008 at 12:51 AM.
    Inside every little problem, is a big problem trying to get out.

  6. #21
    Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent Gayan Soyza Excellent
    Join Date
    Oct 2006
    Location
    Colombo
    Posts
    1,664
    Blog Entries
    1

    Default

    Off Topic!

    When I design sign boards I first choose correct high efficiency LED's or LED Matrixes.So I can drive them with a low duty cycles later to minimize the power consumption without notifying any brightness changing situations.

  7. #22
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,788

    Default

    Quote Originally Posted by kchriste View Post
    danielsmusic,
    You need at least 0.33uF on the input and 0.1uF on the output of the 7805 or it may become unstable. Put them as close as possible to the 7805. You should also have a 0.1uF close to the PICs power pins.
    Yes, this is why we asked for the COMPLETE circuit, and it shows a complete lack of required capacitors - you need a capacitor on the input pin of the 7805 as well, and a good size electrolytic across the battery.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  8. #23
    danielsmusic Newbie
    Join Date
    Jul 2005
    Location
    cheshire
    Posts
    457

    Default

    I did initially have a capacitor either side of the regulator. I noticed that it seems to slow down the clock speed on the PIC so I removed them.

    EDIT: Only tried >1uF cap on output, I will try the recommended 0.1uf when I get home. And some across the battery.
    Last edited by danielsmusic; 11th December 2008 at 01:53 PM.
    when you post that reply, im just kidding.

  9. #24
    petrv Newbie
    Join Date
    Mar 2008
    Posts
    172

    Default

    you should never leave out the capacitors. I always put 0.1uF ceramic to both input and output of 78XX and also electrolytic capacitors (both on input and output). Also it is highly recommended to put 0.1uF ceramic capacitors to each digital IC (as close to its power pins as possible). Otherwise you can experience some "unexplainable" problems especially at higher speeds and with logic ICs that are fast (high slew rate) and switching bigger currents ....

  10. #25
    danielsmusic Newbie
    Join Date
    Jul 2005
    Location
    cheshire
    Posts
    457

    Default

    Adding any sort of capacitor anywhere in the circuit completely stops the PIC and it does nothing.
    when you post that reply, im just kidding.

  11. #26
    petrv Newbie
    Join Date
    Mar 2008
    Posts
    172

    Default

    If adding a capacitor between +5V and 0V (power supply) stops it from working then I guess your circuit must have much more serious problem than it seems.

  12. #27
    danielsmusic Newbie
    Join Date
    Jul 2005
    Location
    cheshire
    Posts
    457

    Default

    Quote Originally Posted by petrv View Post
    If adding a capacitor between +5V and 0V (power supply) stops it from working then I guess your circuit must have much more serious problem than it seems.
    With a very large capacitor across the battery terminals it will stay flashing a bit longer than without any capacitors at all. Although having the same capacitor across 5v and 0v it won't work at all.
    when you post that reply, im just kidding.

  13. #28
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    What voltage is the battery?
    What voltage does the volt meter show for the battery?

    You really should post the schematic for this thing starting with the battery. It could save a lot of time and posts.

    A picture that was good enough to follow the wiring would be good too.
    Last edited by 3v0; 11th December 2008 at 05:51 PM.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)

  14. #29
    danielsmusic Newbie
    Join Date
    Jul 2005
    Location
    cheshire
    Posts
    457

    Default

    Quote Originally Posted by 3v0 View Post
    What voltage is the battery?
    12V

    Quote Originally Posted by 3v0 View Post
    What voltage does the volt meter show for the battery?
    13V

    Quote Originally Posted by 3v0 View Post
    You really should post the schematic for this thing starting with the battery. It could save a lot of time and posts.
    I posted a picture a bit further up.


    EDIT: Here's something interesting, if I hold an output pin on the PIC high with a small load (LED), it works with a 0.1uF capacitor across the battery, but as I add more across the IC etc it will slow down the PIC although the pattern is still there.
    Last edited by danielsmusic; 11th December 2008 at 06:04 PM.
    when you post that reply, im just kidding.

  15. #30
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,706
    Blog Entries
    5

    Default

    Take a photo of your device, with the caps. Why are you using a shift register why not just drive the LEDs directly from the PIC?
    PS the 74HC595 can only source a couple of mA (it can sink more than it can source) Your LEDs need about 470ohms if you wish to drive them from the 74HC595.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

+ Reply to Thread
Page 2 of 6
First 1 2 3 4 5 6 Last

Similar Threads

  1. PCB Breadboard
    By AtomSoft in forum Datasheet/Parts Requests
    Replies: 6
    Latest: 16th November 2008, 12:43 PM
  2. Breadboard
    By Rumieus in forum General Electronics Chat
    Replies: 7
    Latest: 24th October 2008, 03:37 AM
  3. The Breadboard
    By ElectroMaster in forum Electronic Theory
    Replies: 22
    Latest: 15th October 2008, 01:51 AM
  4. Where can i get one of these? ISA Breadboard...
    By Marks256 in forum General Electronics Chat
    Replies: 4
    Latest: 13th April 2008, 06:40 PM
  5. Using ICs on breadboard
    By daviddoria in forum Electronic Projects Design/Ideas/Reviews
    Replies: 3
    Latest: 25th February 2003, 05:30 PM

Tags for this Thread