#avr Logs

Apr 12 2020

#avr Calendar

01:56 AM markasoftware: If I want to get higher-resolution ADC near ground, am I better off using differential input at 20x gain, with the negative differential at ground, or feeding the voltage reference through a voltage divider?
02:01 AM markasoftware: (i want adc relative to vcc, but just at higher resolution)
05:42 AM Smidge204_: markasoftware: You can select alternate internal references for the ADC, or use the internal DAC as a reference for 8-bit resolution custom reference
02:29 PM evidlo2: if I save the port state on the first line of an ISR, am I guaranteed to capture the correct pin state?
02:35 PM polprog: good question.. im not sure how much does an ISR entry take but you definitely want a naked isr for that
02:36 PM polprog: The interrupt execution response for all the enabled Atmel®AVR® interrupts is four clock cyclesminimum. After four clock cycles, the Program Vector address for the actual interrupt handlingroutine is executed. During this 4-clock cycle period, the Program Counter is pushed onto theStack. The Vector is normally a jump to the interrupt routine, and this jump takes three clockcycles.
02:37 PM evidlo2: also I'm having trouble differentiating button pressing on my board: https://termbin.com/6c62
02:37 PM evidlo2: all the buttons connected to PORTD cause "mode_pressed" to be set
02:37 PM polprog: werid, malwarebytes kills termbin on my machine
02:38 PM polprog: sec
02:40 PM evidlo2: I know the code is a bit ugly right now. It's been touched by several hands
02:42 PM polprog: the code looks ok
02:42 PM polprog: how are you connecting the buttons?
02:44 PM evidlo2: https://imgur.com/a/2r7wTLl
02:44 PM polprog: did you enable the internal pullups
02:45 PM polprog: ?
02:45 PM evidlo2: yes, thats the digitalWrite(X, HIGH) in the first few lines of setup
02:46 PM polprog: ok
02:46 PM polprog: weird.. must be something missing
02:46 PM polprog: it's a shot in the dark but you could try replaing 1 << PD0 with 0x01
02:46 PM polprog: but i dont htink this would help
02:47 PM polprog: you can also try printing the PIND register to uart
02:47 PM evidlo2: yep, same
02:55 PM evidlo2: ok here's the serial output when I press various buttons: https://termbin.com/1t3j
02:55 PM evidlo2: I added Serial.println(PIND) to the top of the ISR
02:58 PM evidlo2: oh wait
02:59 PM evidlo2: PD0 is tied high, so I need to check when its low
03:12 PM evidlo2: why is "bit_is_set(PIND, PD0)" not the same as "(PIND & (1 << PD0)) == 0" ?
04:23 PM PoppaVic: likely the usual reasons: halfwitted #defines
04:36 PM evidlo2: in avrlib?
05:09 PM PoppaVic: evidlo2: all of the arduino/gcc/avr (and arm?) stuff uses the most ungodly, accursed defines/constants and compile-time magic
05:09 PM PoppaVic: just reading DOWN/thru the headers will make you gag... Add in some c++ to make i worse
11:51 PM day_ is now known as day