+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Newbie level 5
    Points: 1,569, Level: 9

    Join Date
    Jun 2004
    Posts
    10
    Helped
    0 / 0
    Points
    1,569
    Level
    9

    How to use 74HC595 with Pic Basic Pro

    hi how to use 74hc595 with pic basic pro ?

    I need sample code for 74hc595 with pic basic pro language

  2. #2
    Super Moderator
    Points: 41,040, Level: 49
    Fragrance's Avatar
    Join Date
    Jul 2002
    Location
    East Of Earth
    Posts
    1,169
    Helped
    207 / 207
    Points
    41,040
    Level
    49

    74hc595

    hi

    here you go


    3 members found this post helpful.

    •   Alt3rd May 2005, 13:50

      advertising

        
       

  3. #3
    Newbie level 5
    Points: 1,569, Level: 9

    Join Date
    Jun 2004
    Posts
    10
    Helped
    0 / 0
    Points
    1,569
    Level
    9

    74hc595 pic

    thanks :)

    I'm test it ok

    but how to shift data one 74hc595 to other 74hc595 ( using 74hc959 serial out ) ?



  4. #4
    Newbie level 5
    Points: 1,463, Level: 8

    Join Date
    Jan 2005
    Posts
    8
    Helped
    0 / 0
    Points
    1,463
    Level
    8

    74hc959

    I too will like help with this IC. I am a Bascom AVR user; I will like to know how to go about making a data table using Bascom AVR, to make my 7 segment Led light.

    I have two seperate Led connected to the shift regiter connected to a AT90S2313, using a 10Mhz crystal.

    This is how it is connected. I am using Common Cathode Leds and using NPN transistors.

    http://home.wanadoo.nl/electro1/avr/...<br /> <br />http://www.blitzlogic.com/7seg_90.GIF

    any help would be appreciated.



    •   Alt4th May 2005, 01:32

      advertising

        
       

  5. #5
    Full Member level 1
    Points: 2,176, Level: 10

    Join Date
    Feb 2004
    Location
    near Finland
    Posts
    108
    Helped
    8 / 8
    Points
    2,176
    Level
    10

    74hc595 bascom

    Searching code for driving 3 7-segment in Winavr or Bascomavr or any C code. Please help me!



  6. #6
    Advanced Member level 2
    Points: 17,714, Level: 32
    ctownsend's Avatar
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    557
    Helped
    86 / 86
    Points
    17,714
    Level
    32

    bascom 74hc595

    Quote Originally Posted by node
    I too will like help with this IC. I am a Bascom AVR user; I will like to know how to go about making a data table using Bascom AVR, to make my 7 segment Led light.

    I have two seperate Led connected to the shift regiter connected to a AT90S2313, using a 10Mhz crystal.

    This is how it is connected. I am using Common Cathode Leds and using NPN transistors.

    http://home.wanadoo.nl/electro1/avr/...<br /> <br />http://www.blitzlogic.com/7seg_90.GIF

    any help would be appreciated.
    here's a bit of code that will work with the 2313. The 2313 supports the lpm instruction so you don't have to store the table in eeprom. You can store the table in the flash and just use the lpm instruction to fetch the correct byte.

    If your pinout is the same as the one here:
    http://members.ziggo.nl/electro1/avr/7segments.htm

    this will work for you (with some extra code for setting up ports, stack, etc.)

    **SORRY, I don't do Bascom, asm only.***

    Code:
    .equ	 LOW = r21
    .equ	HIGH = r22
    .equ	STCP = 2	;storage clock
    .equ	SHCP = 3	;shift clock
    .equ	DS = 4		;data bit
    
    
    Update_display_LOW:
    	ldi	ZL,LOW (table*2)
    	ldi	ZH,HIGH(table*2)
    	add	ZL, LOW		;add offset to base
    	lpm			;read data to r0          
             
    	mov	r18,R0
    	rcall	ShiftByte	;send byte to 74HC595
    	cbi    PORTB, 1	; turn on low display (ones)	
    	ret
    ;----------------------------------------------------------
    Update_display_HIGH:
    	ldi	ZL,LOW (table*2)
    	ldi	ZH,HIGH(table*2)
    	add	ZL, HIGH	;add offset to base
    	lpm			;read data to r0
    	
    	mov	r18,R0
    	rcall	ShiftByte	;send byte to 74HC595
    
            cbi    PORTB, 0   	; turn on high display (tens)
    	ret
    ;----------------------------------------------------------
    Table:
    .db 0b00111111,0b00000110,0b01011011,0b01001111
    .db 0b01100110,0b01101101,0b01111100,0b00000111
    .db 0b01111111,0b01100111
    ;----------------------------------------------------------
    ShiftByte:
    	  ldi    r19, 8    	; 8 bits to shift
    ShiftLoop:
    	  sbrc   r18, 0       ; skip if bit 0 = clr
              sbi    PORTB, DS    ; else send a 1
              sbrs   r18, 0       ; send a 0
              cbi    PORTB, DS    ; 
              sbi    PORTB, SHCP  ; pulse shift clock
              lsr    r18          ; next bit
              cbi    PORTB, SHCP  ; end shift clock pulse
              dec    r19          ; one less bit
               brne  ShiftLoop    ; loop for 8 bits
    
              sbi    PORTB, STCP  ; pulse storage clock high
              nop                 ; 
              cbi    PORTB, STCP  ; then return low
              ret                 ; 
    ;----------------------------------------------------------
    If your pinout changes, you simply have to modify the table.
    If you are not using a shift register, all you have to do is replace the lines:
    Code:
    	rcall	ShiftByte	;send byte to 74HC595
    with this:
    Code:
    out PORTB,r18       ;of course you will have to change the other pins already using portb.
    It should work provided the pinout is the same as the one in shift register schematic (in the link above)
    Good Luck



  7. #7
    Newbie level 3
    Points: 413, Level: 4

    Join Date
    Sep 2010
    Posts
    4
    Helped
    0 / 0
    Points
    413
    Level
    4

    Re: 74hc595

    ---------- Post added at 13:20 ---------- Previous post was at 13:20 ----------

    [/COLOR]
    Quote Originally Posted by Fragrance View Post
    hi

    here you go
    hi....i dont know how to program in basic...can you make an equivalent of this project using pic assembly with the same circuit?..
    it will be a great help on how to use 74hc595...tnx



  8. #8
    Advanced Member level 5
    Points: 36,370, Level: 46

    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    5,965
    Helped
    1842 / 1842
    Points
    36,370
    Level
    46

    Re: How to use 74HC595

    Can somebody explain the fascination in using 74HC595 as LED drivers? It's probably the last thing the manufacturer had in mind for these devices but somehow people seem to pick them as a first choice driving displays.
    Brian.



  9. #9
    Newbie level 3
    Points: 413, Level: 4

    Join Date
    Sep 2010
    Posts
    4
    Helped
    0 / 0
    Points
    413
    Level
    4

    Re: bascom 74hc595

    Quote Originally Posted by ctownsend View Post
    here's a bit of code that will work with the 2313. The 2313 supports the lpm instruction so you don't have to store the table in eeprom. You can store the table in the flash and just use the lpm instruction to fetch the correct byte.

    If your pinout is the same as the one here:
    ATtiny.com | Controlling LED displays with an AVR

    this will work for you (with some extra code for setting up ports, stack, etc.)

    **SORRY, I don't do Bascom, asm only.***

    Code:
    .equ	 LOW = r21
    .equ	HIGH = r22
    .equ	STCP = 2	;storage clock
    .equ	SHCP = 3	;shift clock
    .equ	DS = 4		;data bit
    
    
    Update_display_LOW:
    	ldi	ZL,LOW (table*2)
    	ldi	ZH,HIGH(table*2)
    	add	ZL, LOW		;add offset to base
    	lpm			;read data to r0          
             
    	mov	r18,R0
    	rcall	ShiftByte	;send byte to 74HC595
    	cbi    PORTB, 1	; turn on low display (ones)	
    	ret
    ;----------------------------------------------------------
    Update_display_HIGH:
    	ldi	ZL,LOW (table*2)
    	ldi	ZH,HIGH(table*2)
    	add	ZL, HIGH	;add offset to base
    	lpm			;read data to r0
    	
    	mov	r18,R0
    	rcall	ShiftByte	;send byte to 74HC595
    
            cbi    PORTB, 0   	; turn on high display (tens)
    	ret
    ;----------------------------------------------------------
    Table:
    .db 0b00111111,0b00000110,0b01011011,0b01001111
    .db 0b01100110,0b01101101,0b01111100,0b00000111
    .db 0b01111111,0b01100111
    ;----------------------------------------------------------
    ShiftByte:
    	  ldi    r19, 8    	; 8 bits to shift
    ShiftLoop:
    	  sbrc   r18, 0       ; skip if bit 0 = clr
              sbi    PORTB, DS    ; else send a 1
              sbrs   r18, 0       ; send a 0
              cbi    PORTB, DS    ; 
              sbi    PORTB, SHCP  ; pulse shift clock
              lsr    r18          ; next bit
              cbi    PORTB, SHCP  ; end shift clock pulse
              dec    r19          ; one less bit
               brne  ShiftLoop    ; loop for 8 bits
    
              sbi    PORTB, STCP  ; pulse storage clock high
              nop                 ; 
              cbi    PORTB, STCP  ; then return low
              ret                 ; 
    ;----------------------------------------------------------
    If your pinout changes, you simply have to modify the table.
    If you are not using a shift register, all you have to do is replace the lines:
    Code:
    	rcall	ShiftByte	;send byte to 74HC595
    with this:
    Code:
    out PORTB,r18       ;of course you will have to change the other pins already using portb.
    It should work provided the pinout is the same as the one in shift register schematic (in the link above)
    Good Luck
    hi...can you translate this program using pic?....pls need help for my project..



  10. #10
    Advanced Member level 3
    Points: 5,367, Level: 17

    Join Date
    Jul 2009
    Posts
    734
    Helped
    81 / 86
    Points
    5,367
    Level
    17

    Re: How to use 74HC595

    how to use 74hc595
    by reading its datasheet?



+ Post New Thread
Please login