Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use 74HC595 with Pic Basic Pro

Status
Not open for further replies.

darkman

Newbie level 5
Newbie level 5
Joined
Jun 16, 2004
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
63
hi how to use 74hc595 with pic basic pro ?

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

74hc595 pic

thanks :)

I'm test it ok

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

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... are the transistors connection to the Leds http://www.blitzlogic.com/7seg_90.GIF

any help would be appreciated.
 

74hc595 bascom

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

bascom 74hc595

node said:
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... are the transistors connection to the Leds 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:
**broken link removed**

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
 

Re: 74hc595

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

[/COLOR]
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
 

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.
 

Re: bascom 74hc595

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:
**broken link removed**

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

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top