diff --git a/UserSpaceArduinoUno_via_Ulisp/code/1_initial_tests/echoulisp7b.dat b/UserSpaceArduinoUno_via_Ulisp/code/1_initial_tests/echoulisp7b.dat new file mode 100755 index 0000000..3f17083 --- /dev/null +++ b/UserSpaceArduinoUno_via_Ulisp/code/1_initial_tests/echoulisp7b.dat @@ -0,0 +1,19 @@ +(defun b () + (pinmode 7 :output) + (digitalwrite 7 nil) + (delay 500) + (digitalwrite 7 t) + (delay 200) + (digitalwrite 7 nil) + (delay 500) + (digitalwrite 7 t) + (delay 200) + (digitalwrite 7 nil) + (delay 500) + (digitalwrite 7 t) + (delay 200) + (digitalwrite 7 nil) + (delay 500) + (digitalwrite 7 ti) + (delay 500)) +(b) diff --git a/UserSpaceArduinoUno_via_Ulisp/code/1_initial_tests/echoulisp7c.dat b/UserSpaceArduinoUno_via_Ulisp/code/1_initial_tests/echoulisp7c.dat new file mode 100755 index 0000000..475cd56 --- /dev/null +++ b/UserSpaceArduinoUno_via_Ulisp/code/1_initial_tests/echoulisp7c.dat @@ -0,0 +1,15 @@ +(defun b () + (pinmode 7 :output) + (digitalwrite 7 t) + (delay 200) + (digitalwrite 7 nil) + (delay 500) + (digitalwrite 7 t) + (delay 200) + (digitalwrite 7 nil) + (delay 500) + (digitalwrite 7 t) + (delay 200) + (digitalwrite 7 nil) + (delay 500)) +(b) diff --git a/UserSpaceArduinoUno_via_Ulisp/datasheets/FT232R_v104.pdf b/UserSpaceArduinoUno_via_Ulisp/datasheets/FT232R_v104.pdf new file mode 100644 index 0000000..c7e9ff7 Binary files /dev/null and b/UserSpaceArduinoUno_via_Ulisp/datasheets/FT232R_v104.pdf differ diff --git a/UserSpaceArduinoUno_via_Ulisp/datasheets/mcp4725.pdf b/UserSpaceArduinoUno_via_Ulisp/datasheets/mcp4725.pdf new file mode 100644 index 0000000..1f6e609 Binary files /dev/null and b/UserSpaceArduinoUno_via_Ulisp/datasheets/mcp4725.pdf differ diff --git a/UserSpaceArduinoUno_via_Ulisp/notes/i2c_write_mcp4725 b/UserSpaceArduinoUno_via_Ulisp/notes/i2c_write_mcp4725 new file mode 100644 index 0000000..d6cdd6a --- /dev/null +++ b/UserSpaceArduinoUno_via_Ulisp/notes/i2c_write_mcp4725 @@ -0,0 +1,222 @@ +14 bit registers + +extra bits at end are ignored + +data sheet for mxp4725 page 25 is good example + +you send something like +4 bytes +first is address byte +which is found via +(defun scn () + (dotimes (p 127) + (with-i2c (str p) + (when str (print p))))) +then +run + (scn) +in ulisp + +three bytes will be as in page 25 + +8 bit bytes + +as in ulisp i2c page: + +// +Writing to a slave +For example, to write the three bytes 0, 1, and 2 to a slave device with address #x70 you would use: + +(with-i2c (str #x70) + (write-byte 0 str) + (write-byte 1 str) + (write-byte 2 str)) + +// + +so as a test +i want to write +0b01000000 +first byte +second byte will be +0-4096 +divided across +two bytes with last 4 bits being blank + +so just play around. +0b11110000 +0b11110000 +two bytes of that + +and see what outputs. + +can we output binary direct into i2c in ulisp? or do we need +decimal? + +so basic test: +(with-i2c (str #x96) + (write-byte #b01000000 str) + (write-byte #b11110000 str) + (write-byte #b11110000 str)) +that doesn't work +(with-i2c (str #x96) + (write-byte 0b01000000 str) + (write-byte 0b11110000 str) + (write-byte 0b11110000 str)) +error: no room for long symbols + +in that case +(with-i2c (str #x96) + (write-byte 64 str) + (write-byte 192 str) + (write-byte 192 str)) + +note: 192 == 11000000 + +sorry + +needs to be in function + +(defun go () + (with-i2c (str #x96) + (write-byte #x40 str) + (write-byte #xc0 str) + (write-byte #xc0 str))) + +still getting +256> (go) + +@⸮⸮ + +nil + +doesnt' seem to send the bytes i want... + +EDIT: the address bit is +decimal 96, not hex 96. got this in 5-10 minutes. + +ok + + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #xc0 str) + (write-byte #xc0 str))) + + 256> (defun go2 () (with-i2c (str 96) (write-byte #x40 str) (write-byte #xc0 str) (write-byte #xc0 str))) + +go2 + + + +229> (go2) + +nil + +so, nil. no response from mcp, but +now output is 4 volts. success. + +that's pretty much it for a test. now just to clarify the numbers I need to +get 0-1V and also to get 1v on output when it starts up (via eeprom) + +let's play first. + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #x00 str) + (write-byte #xA0 str))) + +redefining functions, saves on memory + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #x0F str) + (write-byte #xF0 str))) +about 500mV + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #xFF str) + (write-byte #xF0 str))) +max at 5v + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #xFF str) + (write-byte #x00 str))) +still max + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #x4F str) + (write-byte #x00 str))) + +1.75V + +pretty much that last byte is useless. small amounts of resolution +in this application + +so let's focus on byte 2 + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte 200 str) + (write-byte #x00 str))) +4volts + +I need a printout of hex to byte for 0-F on my wall... +but instead, lets use decimal. easier here. + + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte 100 str) + (write-byte #x00 str))) +2.05volts + +1.05 volts for 50 +since 50 is roughly 1/5 of 255... 1/5 of VDD + +so i want my cpu load converted from whatever it is, to a number +from 0-1, then take 0-1 of 48 or so. + +if you send this: + +(defun go2 () (with-i2c (str 96) (write-byte #x40 str) (write-byte 48 str) (write-byte #x00 str))) (go2) +as one line, you can see it change instantly. (not using variables yet) + +so 47 is 1 volt. that will be 100% + +0 will be 0. + +basically done. +now to write 0 to eeprom + +(defun go2 () + (with-i2c (str 96) + (write-byte #x60 str) + (write-byte 0 str) + (write-byte 0 str))) + +let's restart and make sure its at 0. +otherwise my dial will break + +looks good. EDIT: well it's at 200mV, but good enough for now. + +don't care really, as long as its lthan 1v. + +let's write again. wrote to ram. works. restarted, and value is at 200mv. + +OK. all set. Now to build and deploy. + + + + diff --git a/UserSpaceArduinoUno_via_Ulisp/notes/i2c_write_mcp4725_BAK b/UserSpaceArduinoUno_via_Ulisp/notes/i2c_write_mcp4725_BAK new file mode 100644 index 0000000..d6cdd6a --- /dev/null +++ b/UserSpaceArduinoUno_via_Ulisp/notes/i2c_write_mcp4725_BAK @@ -0,0 +1,222 @@ +14 bit registers + +extra bits at end are ignored + +data sheet for mxp4725 page 25 is good example + +you send something like +4 bytes +first is address byte +which is found via +(defun scn () + (dotimes (p 127) + (with-i2c (str p) + (when str (print p))))) +then +run + (scn) +in ulisp + +three bytes will be as in page 25 + +8 bit bytes + +as in ulisp i2c page: + +// +Writing to a slave +For example, to write the three bytes 0, 1, and 2 to a slave device with address #x70 you would use: + +(with-i2c (str #x70) + (write-byte 0 str) + (write-byte 1 str) + (write-byte 2 str)) + +// + +so as a test +i want to write +0b01000000 +first byte +second byte will be +0-4096 +divided across +two bytes with last 4 bits being blank + +so just play around. +0b11110000 +0b11110000 +two bytes of that + +and see what outputs. + +can we output binary direct into i2c in ulisp? or do we need +decimal? + +so basic test: +(with-i2c (str #x96) + (write-byte #b01000000 str) + (write-byte #b11110000 str) + (write-byte #b11110000 str)) +that doesn't work +(with-i2c (str #x96) + (write-byte 0b01000000 str) + (write-byte 0b11110000 str) + (write-byte 0b11110000 str)) +error: no room for long symbols + +in that case +(with-i2c (str #x96) + (write-byte 64 str) + (write-byte 192 str) + (write-byte 192 str)) + +note: 192 == 11000000 + +sorry + +needs to be in function + +(defun go () + (with-i2c (str #x96) + (write-byte #x40 str) + (write-byte #xc0 str) + (write-byte #xc0 str))) + +still getting +256> (go) + +@⸮⸮ + +nil + +doesnt' seem to send the bytes i want... + +EDIT: the address bit is +decimal 96, not hex 96. got this in 5-10 minutes. + +ok + + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #xc0 str) + (write-byte #xc0 str))) + + 256> (defun go2 () (with-i2c (str 96) (write-byte #x40 str) (write-byte #xc0 str) (write-byte #xc0 str))) + +go2 + + + +229> (go2) + +nil + +so, nil. no response from mcp, but +now output is 4 volts. success. + +that's pretty much it for a test. now just to clarify the numbers I need to +get 0-1V and also to get 1v on output when it starts up (via eeprom) + +let's play first. + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #x00 str) + (write-byte #xA0 str))) + +redefining functions, saves on memory + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #x0F str) + (write-byte #xF0 str))) +about 500mV + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #xFF str) + (write-byte #xF0 str))) +max at 5v + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #xFF str) + (write-byte #x00 str))) +still max + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte #x4F str) + (write-byte #x00 str))) + +1.75V + +pretty much that last byte is useless. small amounts of resolution +in this application + +so let's focus on byte 2 + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte 200 str) + (write-byte #x00 str))) +4volts + +I need a printout of hex to byte for 0-F on my wall... +but instead, lets use decimal. easier here. + + +(defun go2 () + (with-i2c (str 96) + (write-byte #x40 str) + (write-byte 100 str) + (write-byte #x00 str))) +2.05volts + +1.05 volts for 50 +since 50 is roughly 1/5 of 255... 1/5 of VDD + +so i want my cpu load converted from whatever it is, to a number +from 0-1, then take 0-1 of 48 or so. + +if you send this: + +(defun go2 () (with-i2c (str 96) (write-byte #x40 str) (write-byte 48 str) (write-byte #x00 str))) (go2) +as one line, you can see it change instantly. (not using variables yet) + +so 47 is 1 volt. that will be 100% + +0 will be 0. + +basically done. +now to write 0 to eeprom + +(defun go2 () + (with-i2c (str 96) + (write-byte #x60 str) + (write-byte 0 str) + (write-byte 0 str))) + +let's restart and make sure its at 0. +otherwise my dial will break + +looks good. EDIT: well it's at 200mV, but good enough for now. + +don't care really, as long as its lthan 1v. + +let's write again. wrote to ram. works. restarted, and value is at 200mv. + +OK. all set. Now to build and deploy. + + + + diff --git a/UserSpaceArduinoUno_via_Ulisp/resources/Pinout_of_ARDUINO_Board_and_ATMega328PU.svg b/UserSpaceArduinoUno_via_Ulisp/resources/Pinout_of_ARDUINO_Board_and_ATMega328PU.svg new file mode 100644 index 0000000..f19912f --- /dev/null +++ b/UserSpaceArduinoUno_via_Ulisp/resources/Pinout_of_ARDUINO_Board_and_ATMega328PU.svg @@ -0,0 +1,10995 @@ + +image/svg+xml18 FEB 2013 +BY ND +www.pighixxx.com +ver 2 rev 2 - 05.03.2013 +Connected to the ATMegaand used for USB programand communicating with it +UNO +ARDUINO +THEDEFINITIVE +PINOUT DIAGRAM +POWERJACK +USBJACK +0 +RXD +PCINT16 +2PD0 +1 +TXD +PCINT17 +RX +TX +3PD1 +2 +INT0 +PCINT18 +4PD2 +3 +INT1 +PCINT19 +PWM +OC2B +5PD3 +6 +AIN0 +PCINT22 +PWM +OC0A +12PD6 +10 +OC1B +PCINT2 +PWM +SS +16PB2 +11 +OC2A +PCINT3 +PWM +MOSI +17PB3 +GND +AREF +21 +AREF +12 +PCINT4 +MISO +18PB4 +8 +CLKO +PCINT0 +ICP1 +14PB0 +7 +AIN1 +PCINT23 +13PD7 +5 +T1 +PCINT21 +PWM +11PD5 +9 +OC1A +PCINT1 +PWM +15PB1 +4 +T0 +PCINT20 +XCK +6PD4 +13 +PCINT5 +SCK +19PB5 +PCINT12 +ADC4 +SDA +27PC4 +18A4 +PCINT13 +ADC5 +SCL +28PC5 +19A5 +SCL +ADC5 +PCINT13 +28PC5 +19A5 +SDA +ADC4 +PCINT12 +27PC4 +18A4 +RESET +PCINT14 +1PC6 +ADC3 +PCINT11 +26PC3 +17A3 +ADC2 +PCINT10 +25PC2 +16A2 +ADC1 +PCINT9 +24PC1 +15A1 +ADC0 +PCINT8 +23PC0 +14A0 +VIN +GND +GND +5V +IOREF +3V3 +RESET +PCINT14 +1PC6 +11 +OC2A +PCINT3 +PWM +MOSI +17PB3 +12 +PCINT4 +MISO +18PB4 +13 +PCINT5 +SCK +19PB5 +GND +5V +MOSI2 +MISO2 +RESET2 +SCK2 +GND +5V +Not Connected +ATMEGA8U2/ATMEGA16U2 ICSP +RESET Button +Cut to disable the auto-reset +R3 OnlyR3 Only +Absolute max 200mA +for entire package +Absolute +max per pin 40mAreccomended 20mA +The input voltage to the Arduino board whenit is running from external power. +Not USB bus power. +GNDPowerControlPhysical PinPort PinPin FunctionDigital PinAnalog Related PinPWM PinSerial PinIDESource Total 150mA +12345678910111213142827262524232221201918171615 +ATMEGA328 +RESET +PC6 +PCINT14 +RXD +PD0 +PCINT16 +0 +TXD +PD1 +PCINT17 +1 +INT0 +PD2 +PCINT18 +2 +INT1 +PD3 +PCINT19 +3 +OC2B +PWM +XTAL1 +PB6 +PCINT6 +OSC1 +XTAL2 +PB7 +PCINT7 +OSC2 +XCK +PD4 +PCINT20 +4 +T0 +CLKO +PB0 +PCINT0 +8 +ICP1 +VCC +VCC +AREF +GND +GND +T1 +PD5 +PCINT21 +5 +PWM +OC0B +AIN0 +PD6 +PCINT22 +6 +PWM +OC0A +AIN1 +PD7 +PCINT23 +7 +OC1A +PB1 +PCINT1 +9 +PWM +OC1B +PB2 +PCINT2 +10 +PWM +SS +OC2A +PB3 +PCINT3 +11 +PWM +MOSI +ADC4 +PC4 +PCINT12 +A4 +SDA +ADC5 +PC5 +PCINT13 +A5 +SCL +MISO +PB4 +PCINT4 +12 +SCK +PB5 +PCINT5 +13 +ADC0 +PC0 +PCINT8 +A0 +ADC1 +PC1 +PCINT9 +A1 +ADC2 +PC2 +PCINT10 +A2 +ADC3 +PC3 +PCINT11 +A3 +2.1mmVINGND +7-12V Dependingon current drawn +USB JACKTYPE B +This provides a logic reference voltagefor shields that use it. It is connected to the 5V bus. + \ No newline at end of file