Hi, i have problem with ATtiny3217. I am trying to display something on 7seg display via I2c.
My set:
>ATtiny3217
>I2c expander - PCF8574
The problem is following:
>The display is working properly when i multiplex the 7segment display in while loop in my code
>Whenever i enable interrupts whole thing crashes, diode stops blinking and i can’t see any change on the display. Also P/S diode is blinking automatically
>When I disattache +5V cable on my breadboard, the diode starts blinking
>sometimes when i unplug and plug the +5V to display, it starts working
I know for sure that the way i display something on the display is working, but whenever i want to refresh display via interrupts, or when i just simply turn the interrupts on, the display wont work.
Also can someone explain to me how to connect pull-up resistors to the expander?
ps. I know that digits i am currently displaying don’t make sence, but im just trying to get the display working with dynamicly displayed symbols
#include <atmel_start.h>
#include <util/delay.h>
#include "include/i2c_simple_master.h"
uint8_t segmenty[] = {0x00, 0x01, 0x02, 0x04, 0x08, 0x0F};
//uint8_t pozycje[] = {0x00, 0x10, 0x20, 0x40, 0x80, 0xF0};
uint8_t pozycje[] = {0x10, 0x20, 0x40, 0x80};
uint8_t dane[] = {1,0,2,4};
ISR(TCA0_OVF_vect)
{
DIODA_toggle_level(); //LED blink
//static int inc =0;
//I2C_0_read1ByteRegister(0x20, (pozycje[inc]+segmenty[dane[inc]]));
//if (inc++==3){
//inc =0;
//}
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm;
}
int main(void)
{
/* Initializes MCU, drivers and middleware */
atmel_start_init();/* Replace with your application code */
while (1) {
static int inc =0;
I2C_0_read1ByteRegister(0x20, (pozycje[inc]+segmenty[dane[inc]]));
if (inc++==3){
inc =0;
}
}
}