From 537f4883a66d068523235b4b610065f978c0b5c3 Mon Sep 17 00:00:00 2001 From: Fred Warden Date: Sat, 4 Jul 2015 23:07:14 -0400 Subject: [PATCH 1/6] Update temp18b20.pde added Fahrenheit formula from Moreno --- examples/06.Sensors/DS18B20/temp18b20.pde | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/examples/06.Sensors/DS18B20/temp18b20.pde b/examples/06.Sensors/DS18B20/temp18b20.pde index a532335..ab8e995 100755 --- a/examples/06.Sensors/DS18B20/temp18b20.pde +++ b/examples/06.Sensors/DS18B20/temp18b20.pde @@ -1,37 +1,44 @@ -/* ----------------------------------------------------------------------- +/* ----------------------------------------------------------------------- Pinguino example to read ds18b20 1wire temperature sensor Result is sent on usb-serial bus and can be read with index.php author Régis Blanchot first release 14/09/2010 last update 10/06/2011 IDE Pinguino > b9.5 - ----------------------------------------------------------------------- + ----------------------------------------------------------------------- DS18B20 wiring - ----------------------------------------------------------------------- + ----------------------------------------------------------------------- pin 1: GND pin 2: DQ (Data in/out) must be connected to the PIC pin 3: VDD (+5V) NB : 1-wire bus (DQ line) must have 4K7 pull-up resistor (connected to +5V) - ----------------------------------------------------------------------- + ----------------------------------------------------------------------- Data's are sent to /dev/ttyACM0 Make sure you have persmission on it : sudo chmod 777 /dev/ttyACM0 Maybe you will have to add your user name to the dialup group ----------------------------------------------------------------------*/ #define ONEWIREBUS 14 // DQ line - +int ifar; +int ffar; void setup() { } void loop() { - TEMPERATURE t; - + TEMPERATURE t; + ifar = t.integer * 100; + ifar += t.fraction; + + ifar = ((ifar * 9) / 5) + 3200; + ffar = ifar % 100; + ifar /= 100; if (DS18B20.read(ONEWIREBUS, SKIPROM, RES12BIT, &t)) { if (t.sign) CDC.printf("-"); - CDC.printf("%d.%d°C \r", t.integer, t.fraction); + //CDC.printf("%d.%d°C \r", t.integer, t.fraction); + CDC.printf("%d.%d°C \r", ifar,ffar); } delay(1000); } From ae53956be11ad318027491fefed2e919fe70dfdb Mon Sep 17 00:00:00 2001 From: Fred Warden Date: Sun, 5 Jul 2015 18:02:30 -0400 Subject: [PATCH 2/6] Update temp18b20.pde --- examples/06.Sensors/DS18B20/temp18b20.pde | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/06.Sensors/DS18B20/temp18b20.pde b/examples/06.Sensors/DS18B20/temp18b20.pde index ab8e995..171be4c 100755 --- a/examples/06.Sensors/DS18B20/temp18b20.pde +++ b/examples/06.Sensors/DS18B20/temp18b20.pde @@ -3,8 +3,8 @@ Result is sent on usb-serial bus and can be read with index.php author Régis Blanchot first release 14/09/2010 - last update 10/06/2011 - IDE Pinguino > b9.5 + last update 6/05/2015 + IDE Pinguino > 11 ----------------------------------------------------------------------- DS18B20 wiring ----------------------------------------------------------------------- From cea6461b70780fb031d9e77eb3ba62e1f5b07cb9 Mon Sep 17 00:00:00 2001 From: Fred Warden Date: Sat, 31 Oct 2015 19:08:38 -0400 Subject: [PATCH 3/6] Update temp18b20.pde --- examples/06.Sensors/DS18B20/temp18b20.pde | 38 ++++++++++++++--------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/examples/06.Sensors/DS18B20/temp18b20.pde b/examples/06.Sensors/DS18B20/temp18b20.pde index 171be4c..e6a9ff9 100755 --- a/examples/06.Sensors/DS18B20/temp18b20.pde +++ b/examples/06.Sensors/DS18B20/temp18b20.pde @@ -3,8 +3,8 @@ Result is sent on usb-serial bus and can be read with index.php author Régis Blanchot first release 14/09/2010 - last update 6/05/2015 - IDE Pinguino > 11 + last update 10/06/2011 + IDE Pinguino > b9.5 ----------------------------------------------------------------------- DS18B20 wiring ----------------------------------------------------------------------- @@ -18,27 +18,37 @@ Maybe you will have to add your user name to the dialup group ----------------------------------------------------------------------*/ -#define ONEWIREBUS 14 // DQ line -int ifar; -int ffar; +#define ONEWIREBUS 2 +#define RES_12BIT + +char temp_sign = 0; +u16 ifar; +u8 ffar; + void setup() { -} +} void loop() { - TEMPERATURE t; + TEMPERATURE t; + temp_sign = t.sign ? '-' : '+'; + ifar = t.integer * 100; ifar += t.fraction; - - ifar = ((ifar * 9) / 5) + 3200; + ifar = (((long)ifar * 9) / 5) + 3200; + //ifar = ((ifar * 1.8) + 3200); ffar = ifar % 100; ifar /= 100; - if (DS18B20.read(ONEWIREBUS, SKIPROM, RES12BIT, &t)) - { - if (t.sign) CDC.printf("-"); - //CDC.printf("%d.%d°C \r", t.integer, t.fraction); - CDC.printf("%d.%d°C \r", ifar,ffar); + if (DS18B20.read(ONEWIREBUS, SKIPROM, &t)) +{ + CDC.printf("Temp: %c%2d.%02d C || %c%3d.%02d F\r\n", temp_sign, t.integer, t.fraction, temp_sign, ifar,ffar); + if (ifar > 73) { + + + } delay(1000); } +} + From 0803cdcb8bd0599fe4936c5bc68b99a52c3c8374 Mon Sep 17 00:00:00 2001 From: Fred Warden Date: Sat, 31 Oct 2015 19:16:58 -0400 Subject: [PATCH 4/6] Update temp18b20.pde --- examples/06.Sensors/DS18B20/temp18b20.pde | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/06.Sensors/DS18B20/temp18b20.pde b/examples/06.Sensors/DS18B20/temp18b20.pde index e6a9ff9..b6210ce 100755 --- a/examples/06.Sensors/DS18B20/temp18b20.pde +++ b/examples/06.Sensors/DS18B20/temp18b20.pde @@ -43,12 +43,9 @@ void loop() if (DS18B20.read(ONEWIREBUS, SKIPROM, &t)) { CDC.printf("Temp: %c%2d.%02d C || %c%3d.%02d F\r\n", temp_sign, t.integer, t.fraction, temp_sign, ifar,ffar); - if (ifar > 73) { - - - + } delay(1000); -} + } } From b51d33185c38ba9162f36f2af5661e1a61937dec Mon Sep 17 00:00:00 2001 From: Fred Warden Date: Sat, 31 Oct 2015 19:31:06 -0400 Subject: [PATCH 5/6] Update temp18b20.pde 3rd update --- examples/06.Sensors/DS18B20/temp18b20.pde | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/06.Sensors/DS18B20/temp18b20.pde b/examples/06.Sensors/DS18B20/temp18b20.pde index b6210ce..4a5c9ad 100755 --- a/examples/06.Sensors/DS18B20/temp18b20.pde +++ b/examples/06.Sensors/DS18B20/temp18b20.pde @@ -31,7 +31,10 @@ void setup() } void loop() { - TEMPERATURE t; + TEMPERATURE t; + if (DS18B20.read(ONEWIREBUS, SKIPROM, &t)) +{ + temp_sign = t.sign ? '-' : '+'; ifar = t.integer * 100; @@ -40,12 +43,11 @@ void loop() //ifar = ((ifar * 1.8) + 3200); ffar = ifar % 100; ifar /= 100; - if (DS18B20.read(ONEWIREBUS, SKIPROM, &t)) -{ + CDC.printf("Temp: %c%2d.%02d C || %c%3d.%02d F\r\n", temp_sign, t.integer, t.fraction, temp_sign, ifar,ffar); } delay(1000); } -} + From b8edc87c6662ddf6d8cb9da95e77584b3f662084 Mon Sep 17 00:00:00 2001 From: Fred Warden Date: Tue, 12 Jan 2016 21:14:02 -0500 Subject: [PATCH 6/6] Update IRremote.c --- p8/include/pinguino/libraries/IRremote.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/p8/include/pinguino/libraries/IRremote.c b/p8/include/pinguino/libraries/IRremote.c index 31724c7..f977989 100755 --- a/p8/include/pinguino/libraries/IRremote.c +++ b/p8/include/pinguino/libraries/IRremote.c @@ -301,7 +301,7 @@ void IRsend_mark(u16 time) // while () {} needs much less time than for (;;) {} // for loop without NOPs : ~ 1,3 ms (889 iterations on 18f26j50) - // while loop without NOPs: ~ 712 µs (889 Iterations on 18f26j50) + // while loop without NOPs: ~ 712 µs (889 Iterations on 18f26j50) while (i) { _1us_ i--; @@ -364,9 +364,9 @@ void IRrecv_enableIRIn(u8 recvpin) // Timer3 is on 16 bits, prescaler 1, based on external crystal Frequency #if defined(__18f25k50) || defined(__18f45k50) - T3CON = T3_OFF | T3_16BIT | T3_SYNC_EXT_OFF | T3_SOSC_OFF | T3_PS_1_1 | T3_RUN_FROM_OSC; + T3CON = T3_OFF | T3_16BIT | T3_SYNC_EXT_OFF | T3_SOSC_OFF | T3_PS_1_1 | T3_SOURCE_FOSC; #else - T3CON = T3_OFF | T3_16BIT | T3_SYNC_EXT_OFF | T3_OSC_OFF | T3_PS_1_1 | T3_RUN_FROM_OSC; + T3CON = T3_OFF | T3_16BIT | T3_SYNC_EXT_OFF | T3_OSC_OFF | T3_PS_1_1 | T3_SOURCE_FOSC; #endif // nb cycles for 50us