Current News

Moderator: Mmiscool

User avatar
By forlotto
#46050 Something to address is any changes in wget usage I have seen a few complaints on this as well ...

Wow shift registers are supported by basic?

Any information on the hookup procedure as well as the code to make this happen this would make every nodemcu just as valuable as the next...

Great stuff cicciocb keep it coming I guess my lack of awareness on this being supported is what has slowed my progress on this front. GPIO addition will be useful to many projects there have been plenty of questions on GPIO expansion over the time I have visited these forums I've seen solutions obviously I chose the solution with the least amount of hardware but does not make it the best choice ...

Going to order some of these GPIO expansion breakout boards soon so I can have added GPIO for certain projects all that I can say is wow this is sweet if it is a workable solution as of right now relays are limited to 6 for the nodemcu I wonder if pwo operations and interrupts will also be allowed for these pins as well as on/off it might be pushing it.

But believe it or not a guide on how to expand GPIO should be on the top priorty list for basic for many different reasons I almost guarantee more users involved with this addition.

All examples I see is for arduino base the less hardware the better imho some cases require the cramming of a lot of hardware into small spaces arduino is just too large for this and sucks more power imho not I prefer arduino free basic but I am sure there are projects where it would make since to use arduino just not something as simplistic as GPIO expansion.

I will look into this a bit more later to see if I can just figure it out as I know basic was built off of the arduino code for the esp but IDK don't recall if shift registers were implemented or not haven't seen any examples and going over the C code a while back I guess I really did not notice anything about it either or if I did I had over looked it.

Cicciocb is there anything that you need to make this happen if so let me know and I will help supply some funding for the parts to you or maybe there is some other parts you need for improvement let me have them shipped to you!

You are doing an amazing job I have been wishing for mike to get help of someone a bit more in tune with programming for a while now to focus on moving the project along then you came along and have been a great help.

Let me know anything you need that would be useful for improving basic withing reason and if I can afford it I will purchase and ship it to you to show appreciation for such dedicated dev work for basic you have done an excellent job here and would love to see the cicciocb continue to be a part of this on going and growing community.

Best info I could find on this so far : http://bildr.org/2011/08/74hc595-breakout-arduino/
User avatar
By cicciocb
#46062 Yes, the 74HC595 are supported, just question of writing some lines of code.
In fact, even without H/W SPI support, you can still use SPI with bitbang.

I made a little schematic showing how connect both the MCP23S17 and the 74HC595.
It can be found here :
https://raw.githubusercontent.com/cicci ... 4hc595.PNG

The code to drive the 74HC595 with bitbang is the following.
This code can be used with the current ESPBasic version . It's not very fast but works.
Code: Select allfor dat = 255 to 0 step -1
  gosub [bitbang]
next

end

''''''''''''''''''''''''''''''''''''
' WRITE to the 74HC595 shift register
' using the bitbang
' this function uses the variables
' dat = data - INPUT -
'''''''''''''''''''''''''''''''''''
[bitbang]
ww = dat
for w = 0 to 7
  b = ww and 128
  if b = 0 then po 13 0 else po 13 1
  po 14 0  'clock
  ww = ww << 1
  po 14 1  'clock
next w
'store
po 2 0
po 2 1
return


With the new version coming, as the SPI H/W is enabled, the same become :
Code: Select allspi.setup(1000000)

for dat = 255 to 0 step -1
  gosub [write_595]
next

end

''''''''''''''''''''''''''''''''''''
' WRITE to the 74HC595 shift register
' using the SPI hardware
' this function uses the variables
' dat = data - INPUT -
'''''''''''''''''''''''''''''''''''
[write_595]
spi.byte(dat)
'store
po 2 0
po 2 1
return


As you can see, using the H/W SPI is easier than the S/W one (and it's much faster too).
At the opposite, with bitbang you can use any pin.

This can be extended using more 74HC595 in series without requiring any additional ESP pin.

Hoping this answer to your needs.

CiccioCB