Timeline for communicating to shift register with ATmega32 without using given SPI pins
Current License: CC BY-SA 3.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 16, 2014 at 3:04 | comment | added | Skate_and_Create | great advice guys. I will use all of your ideas. Also I would really like to try PIC32. I will do that for my next project. :) | |
Jun 15, 2014 at 23:07 | answer | added | Luke | timeline score: 1 | |
Jun 15, 2014 at 22:46 | comment | added | Majenko | Even better better, use a PIC32 which has xxxSET, xxxCLR and xxxINV registers ;) LATBSET = 1<<4; | |
Jun 15, 2014 at 22:32 | comment | added | sherrellbc |
Even better yet, just make a nice macro so you don't have to worry with that syntax anymore. #define setHigh(pin, port) (port |= 1<<pin) and #define setLow(pin, port) (port &= ~(1<<pin)) .
|
|
Jun 15, 2014 at 22:23 | comment | added | Majenko | He's realizing that now ;) PORTB |= 1<<PINB2 to set, and PORTB &= ~(1<<PINB2) to clear. | |
Jun 15, 2014 at 21:26 | comment | added | user45663 | Shouldn't correct syntax be PORTB |= 1<<PINB2; ? The or saves the previously set bits in the PORT B register. | |
Jun 15, 2014 at 20:02 | comment | added | Skate_and_Create | OH! Of course I see now. | |
Jun 15, 2014 at 19:51 | comment | added | Majenko | I think your main problem is your understanding of how the PORTB variable works. Every time you're setting one pin to a state you're turning off all the others. | |
Jun 15, 2014 at 19:49 | comment | added | Skate_and_Create | I've uploaded a simple test that I use. Not even this one works. | |
Jun 15, 2014 at 19:48 | history | edited | Skate_and_Create | CC BY-SA 3.0 |
added 2291 characters in body
|
Jun 15, 2014 at 19:38 | comment | added | Skate_and_Create | I see. I will look more into that. I had also made a very simple test example until I got the disired bits output. but it still didn't work. like: PORTB = 1 << PINB0; // data pin 1 is high PORTB = 0 << PINB1; // clock pin 2 is low PORTB = 0 << PINB2; // latch pin 3 is low // ect.. | |
Jun 15, 2014 at 19:34 | review | First posts | |||
Jun 15, 2014 at 19:42 | |||||
Jun 15, 2014 at 19:33 | comment | added | Majenko | I suggest you download the Arduino IDE, and take a look at the shiftOut() function to see how they do it. Your way seems to be a little bit arse about face if you ask me. | |
Jun 15, 2014 at 19:32 | history | edited | Skate_and_Create | CC BY-SA 3.0 |
removed the "//" comment lines in front of delays
|
Jun 15, 2014 at 19:30 | comment | added | Skate_and_Create | Oh yes, I was seeing if a delay would help at all. I commented them out when I wasn't using them. | |
Jun 15, 2014 at 19:22 | comment | added | Gerben |
Why are all the _delay_ms() s commented out?
|
|
Jun 15, 2014 at 19:15 | history | asked | Skate_and_Create | CC BY-SA 3.0 |