Go to advanced search

by Martwana
Sun Feb 17, 2013 7:46 pm
Forum: C/C++
Topic: 74HC164N Daisy Chain Problem
Replies: 5
Views: 1698

Re: 74HC164N Daisy Chain Problem

I now seem to have fixed it by modifying Gordon Hendersons shiftOut(); Heres the one that works for me. I stripped out the dPin, cPin and ORDER options, as its only really intended for my use. newShiftOut(int val){ int i; for(i = 15; i>=0; --i){ digitalWrite(dataPin, val & (1<<i)); digitalWrite(cloc...
by Martwana
Sun Feb 17, 2013 7:21 pm
Forum: C/C++
Topic: 74HC164N Daisy Chain Problem
Replies: 5
Views: 1698

Re: 74HC164N Daisy Chain Problem

Try: GPIO data out > chip1 A and B parallel with chip 2 A and B, also GPIO clk out > chip1 clk and chip 2 clk. If they dont behave the same swap chips (easy if breadboard project or socketed as you should do) That works fine, they work in tandem there fine. Heres what I'm, trying to do, just to get...
by Martwana
Sun Feb 17, 2013 6:06 pm
Forum: C/C++
Topic: 74HC164N Daisy Chain Problem
Replies: 5
Views: 1698

Re: 74HC164N Daisy Chain Problem

That is exactly as I have wired, but it refuses to work.

I just retired it there, to check, but still no output from the second one at all
by Martwana
Sun Feb 17, 2013 4:15 pm
Forum: C/C++
Topic: 74HC164N Daisy Chain Problem
Replies: 5
Views: 1698

74HC164N Daisy Chain Problem

Hello again, its been a while. I'm having a bit of trouble daisy chaining some '164 shift registers. I have the first hooked up fine, and it works as expected, but by hooking output 8 of register 1 to input a (also tried input b and input a&b and tying one high and low) and joining the clock and cle...
by Martwana
Wed Jan 30, 2013 11:42 pm
Forum: C/C++
Topic: Raspberry Pi MySQL_ROW Question
Replies: 7
Views: 2035

Re: Raspberry Pi MySQL_ROW Question

@Paeryn - I'm sure I tried that method first, but i had no joy with it. @Cromarty - Again, I'm sure i also tried that and had no joy with it. Ill try both tomorrow and if they work then ill save 4/5 lines of code, but it works fine as it is just now and if any improvement can be used, then I'll make...
by Martwana
Wed Jan 30, 2013 9:03 pm
Forum: C/C++
Topic: Raspberry Pi MySQL_ROW Question
Replies: 7
Views: 2035

Re: Raspberry Pi MySQL_ROW Question

How is your database set up? I have just tried your sample program and as long as the pin status field is the first column in the table then your program works. If it isn't the first then you need to change row[0] to row[column_number_of_pin_status]. My sample database (wiringPiPinNumber 5 is ON, a...
by Martwana
Wed Jan 30, 2013 1:28 pm
Forum: C/C++
Topic: update-rc.d startup order
Replies: 3
Views: 2824

Re: update-rc.d startup order

Thanks for the quick reply! How would you reccommend testing if the MySQL server is ready? While I'm on the subject, can I fill an array with results from a query like the PIN numbers that are marked as 'in use' in the db? If its possible, could you could give a little sample of how you would do it ...
by Martwana
Wed Jan 30, 2013 1:08 pm
Forum: C/C++
Topic: update-rc.d startup order
Replies: 3
Views: 2824

update-rc.d startup order

Hello again guys. I've written a C program that checks values in a database and in turn, turns GPIO pins off or on. The program works really good, checks at 1 second intervals, and, according to webmin, only uses just under 1% of the cpu :) Raspberry Pi is running apache, php and mysql, again, all s...
by Martwana
Sat Jan 26, 2013 1:35 pm
Forum: C/C++
Topic: Raspberry Pi MySQL_ROW Question
Replies: 7
Views: 2035

Re: Raspberry Pi MySQL_ROW Question

That wouldn't work either. Compiles fine, just doesn't give the result properly. Here's the whole program, in case someone else can think of it. #include <mysql.h> #include <my_global.h> #include <wiringPi.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> // username = gpio .... password...
by Martwana
Sat Jan 26, 2013 2:36 am
Forum: C/C++
Topic: Raspberry Pi MySQL_ROW Question
Replies: 7
Views: 2035

Raspberry Pi MySQL_ROW Question

Hello, bet your sick of me now :) So, I'm writing a C program to check the installed MySQL server for gpio statuses for my home automation project. Everythings gone great so far. I can query the database using the BCM pin numbers or the wiringPi numbers and get simple 0 or 1 for the pin status. Here...
by Martwana
Wed Jan 23, 2013 8:07 pm
Forum: C/C++
Topic: C Program at boot?
Replies: 3
Views: 1699

C Program at boot?

Heres a silly wee question but yet again, i am not sure what to search online for as my typical searches are not working. I have just perfected the code to run a clock showing the date on a 16x2 display through a shift register. Now, i currently, need to boot the pi, and then ssh into it and run the...
by Martwana
Wed Jan 23, 2013 1:38 am
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

SOLVED. This problem was solved using hardware AND software changes. I was crawling about for any relation between the 74HC164N shift registers and the HD44780 displays. I wish I had the link, but I couldn't find it, but basically it mentioned that both the inputs on that register are ANDed together...
by Martwana
Wed Jan 23, 2013 12:20 am
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

I set the pins in the code correctly. The photos you seen were like my 10th attempt at wiring it. is it maybe the type of shift register? It's a 74HC164N register. I dont know if different kinds wont work with your code. I have no idea where to go from here, I DID want to end up using the shift regi...
by Martwana
Tue Jan 22, 2013 11:50 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

Nope :( Still no joy.

The leds all flicker as they run high and low.

Heres a few pics of the circuit, but i think its right. I've replaced the shift register since i ordered 3 but still no joy.

http://postimage.org/gallery/10tuftpi/f08ab16e/
by Martwana
Tue Jan 22, 2013 10:31 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

The code doesn't compile because I used Python comments to indicate the GPIO physical pin numbers. The code should read: #include <time.h> #include <wiringPi.h> #include <wiringShift.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int clockPin=14; //23 int clearPin=10; //24 int dataPi...
by Martwana
Tue Jan 22, 2013 7:02 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

Im just fiddling about with your code just now, stripped out all the time stuff, just tying to print Hello, World! first, as you do :) I added a tick function to tick the clock when using clear(); tick(){ digitalWrite(clockPin, HIGH); usleep(DELAY); digitalWrite(clockPin, LOW); } Still no joy though...
by Martwana
Tue Jan 22, 2013 6:37 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

Here's my code for running an lcd display off a shift register. I hook the data pins of the lcd to the first four outputs of the shift registers, the register select pin to the fifth output, and the enable pin to the sixth output. That way enable is triggered only when everything else is already se...
by Martwana
Mon Jan 21, 2013 11:25 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

Gutter, my reply went missing. I cannot get the code below to work, it wont even light up LED's. Before the below code is executed, pinMode is set for each of the shift registers control pins. I thought I had understood the code properly, but clearly not! Where am I going wrong. writeDisplay(){ // S...
by Martwana
Mon Jan 21, 2013 5:39 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

Cheers Gordon!

I'll work on it tonight, and let you know the outcome!

I'll likely post the code here if it goes bad anyway :)

Cheers again
by Martwana
Sun Jan 20, 2013 4:40 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

Re: wiringPi & wiringShift

Thanks Gordon. After looking at the lcd.c code, i can semi-understand it, but I need more help. Read this and please correct me if you can. In lcd.c, when initializing the lcd, in 4 bit mode 'func = LCD_FUNC | LCD_FUNC_DL', which according to the #defines is 0x20 and 0x10. | is a bitwise OR, which w...
by Martwana
Sat Jan 19, 2013 9:44 pm
Forum: C/C++
Topic: wiringPi & wiringShift
Replies: 18
Views: 3262

wiringPi & wiringShift

Anyone had any success in combining these two?

Trying to run a 16x2 through a shift register with wiringPi with no idea how to combine the two sets of functions.

All help appreciated :)
by Martwana
Fri Dec 28, 2012 8:47 pm
Forum: C/C++
Topic: WiringPiShift Library and 74HC164N register
Replies: 4
Views: 1531

Re: WiringPiShift Library and 74HC164N register

Okay, here's the script i made, that works fine. Basically, it initializes the 4 pins for the shift register in setupPins(), and tick() moves the clock HIGH then LOW. clear(), is clears the shit register by turning the clear pin LOW then HIGH and ticking the clock. In main(), first, the register is ...
by Martwana
Fri Dec 28, 2012 4:43 pm
Forum: C/C++
Topic: WiringPiShift Library and 74HC164N register
Replies: 4
Views: 1531

Re: WiringPiShift Library and 74HC164N register

Nothing to do with it, i know it was missing one = but i rewrote the script totally. Im not in the house yet, but ill post the script when i get in.
by Martwana
Fri Dec 28, 2012 12:43 am
Forum: C/C++
Topic: WiringPiShift Library and 74HC164N register
Replies: 4
Views: 1531

Re: WiringPiShift Library and 74HC164N register

Not to worry, SOLVED, I'll post details on how I did it tomorrow.
by Martwana
Thu Dec 27, 2012 10:35 pm
Forum: C/C++
Topic: WiringPiShift Library and 74HC164N register
Replies: 4
Views: 1531

WiringPiShift Library and 74HC164N register

Hello yet again Time to learn C now. Managing to control LED's via GPIO no problem using a separate pins, but I wanted to learn how to use shift registers. I found an instructable on using them to drive LED's which I thought was perfect, so I bought a bundle of 74HC164N shift registers so the tutori...

Go to advanced search