So first of all the UART does not sample the data line at the baud rate, it uses oversampling. A classic example is that an 8 MHz AVR can't use standard baud rate of 115200, but if you change the 8 MHz crystal to somewhat slower and commonly available 7.3728 MHz crystal that is known to be UART baud rate friendly, you can achieve exactly 115200 bps with no baud rate error other than the max 0.01% of the crystal itself. So some clock speeds are just not compatible with some baud rates. * The function below prints out data to the terminal orĪssuming the Adafruit Pro Trinket is just an ATMega328P running at 12 MHz, it cannot divide 12 MHz to an UART bit rate of 200 Kbps, while an ATMega328P running at 8 MHz can. One more clock pulse before the actual read Start clock cycle and set start pulse to signal start * Look at the Timing Chart in the Datasheet for more info * This functions reads spectrometer data from SPEC_VIDEO Serial.begin(9600) // Baud Rate set to 9600 #define SPEC_CHANNELS 288 // New Spec ChannelĭigitalWrite(SPEC_CLK, HIGH) // Set SPEC_CLK HighĭigitalWrite(SPEC_ST, LOW) // Set SPEC_ST Low Or is the Trinket not capable of gathering these numbers? (I am getting no errors when compiling the code) I have tried for a while tweaking the code but I have yet to get it to actually save/read values from EEPROM properly, so here's the part of my code(Ignore the rest for running the display+i have removed all of the irrelevant code):ĭisplay.begin(SSD1306_SWITCHCAPVCC, 0x3C) ĭisplay.print(hunger/100) display.print("/") display.print(happiness/100) ĭisplay.drawBitmap(30, 32, Happ圓2_glcd_bmp, 32, 32, 1) ĭisplay.drawBitmap((30+z), 32, Happ圓2_glcd_bmp, 32, 32, 1) ĭisplay.drawBitmap(30, 32, Mild32_glcd_bmp, 32, 32, 1) The Thing I am trying to achieve is it saving the "progress" even when the microcontroller turns off.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |