So I have been playing around with the ATtiny817_Xplained Mini along with an UNO Multifunction Shield of late. The ATtiny817 is one of the new tiny0-series, 1-series and mega 0-series type devices. They apparently borrow some of the Xmega archetecture, not personally familiar with those devices. They have lots of registers that are supposed to circumvent read-modify-write instructions, which means not having to read the register than OR the bits you want to change, you can just write the bits directly.
If anyone plans to investigate these devices, or currently has one, here is GCB demo code to read an analog input, in this case a pot on the MFS, and send it out to a terminal on the alternate USART TX pin. The .dat file is really a mess at the moment and not suitable for publication. If someone wants to have a play, I could email the dat file thru Sourceforge account.
#chip tiny817Xa,3.333333'*****USART*****'DTR pin needs to be set for the ATtiny817-Xplained-mini board'to communicate with a Terminal program!!!'Default Usart is a loaded pin on the Multi-Function Shield (MFS)'so use alternate pins provided by PortMux#define USART_BAUD_RATE 9600#define USART_TX_BLOCKING'define alias'sforattiny0-series,1seriestoworkwithGCBcommands#define UDR0 Usart0_TXDATAL#define UDRE Usart0_Status.DREIF'set up attiny 0-series, 1 series initialization registers manuallyUsart0_CTRLC=0b00000011'asynchronous, no parity, 1 stop bit, 8bits'Usart0_Baud = 1389 '64*3333333/(16*9600)asynchUsart0_BaudH=0b00000101Usart0_BaudL=0b01101101Usart0_CTRLB=0b01000000'enable TXEN bit'change usart0 to alternate pins PA1(TX), and PA2(RX)PortMux_CTRLB=0b00000001PortA_DirSet=0b00000010'alternate TX pin at PA1'*****ADC*****'PA4 is Pot_Pin on MFSPortA_CLR=0b00000100DoHSerPrintReadPotHSerPrintCRLFwait1sLoopFunctionReadPotasWord'VDD bit4=1(Internal=0),CLCK DIV4ADC0_CTRLC=0b00010001'10bit resolution bit2=0/8bit bit2= 1, ADC_Enable bit0ADC0_CTRLA=0b00000001ADC0_MUXPOS=0b00000100'PA4, A0 on MFSADC0_COMMAND=0b00000001'start conversionWaitUntilADC0_INTFLAGS.0=1'RESRDY flag Works'need to clear flag before next conversionADC0_INTFLAGS.0=0ReadPot=ADC0_RESLReadPot_H=ADC0_RESHendFunction
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So I have been playing around with the ATtiny817_Xplained Mini along with an UNO Multifunction Shield of late. The ATtiny817 is one of the new tiny0-series, 1-series and mega 0-series type devices. They apparently borrow some of the Xmega archetecture, not personally familiar with those devices. They have lots of registers that are supposed to circumvent read-modify-write instructions, which means not having to read the register than OR the bits you want to change, you can just write the bits directly.
If anyone plans to investigate these devices, or currently has one, here is GCB demo code to read an analog input, in this case a pot on the MFS, and send it out to a terminal on the alternate USART TX pin. The .dat file is really a mess at the moment and not suitable for publication. If someone wants to have a play, I could email the dat file thru Sourceforge account.
Thanks for your hard work on this kent_twt4