Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Rickta59

  1. # best solution $ while true; do for sensor_file in /tmp/bus/w1/devices/28-*/w1_slave; do echo "scale=2; $(cat ${sensor_file} | grep -E -o ".{0,0}t=.{0,5}" | cut -c 3- )/1000.0" | bc; done; sleep .5; done
  2. I didn't actually look no. If there are, why are you writing another solution?
  3. Ok so when I wrote the first script I didn't really know what the w1_slave returned, it was more an example of what you might do. I went and dug up what I think the w1_slave returns. Here is the format I think it returns, but I really don't know you will have to adjust for it Assumming it returns something like this: $ cat /tmp/bus/w1/devices/28-100000001/w1_slave 4b 01 4b 46 7f ff 05 10 e1 : crc=e1 YES 4b 01 4b 46 7f ff 05 10 e1 t=19065You could use this script: #!/bin/bash # read the w1-temp values # put each line1 and 2 into variables # parse and see if it is ready # if so read th
  4. If you really want to see the resource being used, try the time comand: $ time /tmp/doit.sh 19.34 18.56 19.34 18.56 19.34 18.56 19.34 18.56 ^C real 0m1.776s user 0m0.008s sys 0m0.000s run that on your c code and a script and see what the difference actually is. I think will be surprised how little is going on. -rick BTW: sleep .2 is 200 ms sleep
  5. You are linux. Maybe you should just bash it: #!/bin/bash SENSOR_FILES=$(echo /sys/bus/w1/devices/28-*) while true; do for sensor in ${SENSOR_FILES}; do VALUE=$(sed -e 's/t=//' < $sensor); echo "scale=2; ${VALUE}/1000.0" | bc; done; sleep .2 done; -rick
  6. If the code you wrote above does what you want why do you want to be "c++ complete" ? The big advantage of boost is that it is cross platform and mostly made up of c++ templates except for the operating system stuff (which filesystem code is). If you aren't planning on running this code on any other OS than linux then maybe it isn't worth your time. Only you can decide what is time worthy. -rick
  7. The c++ way on a real os like linux would be to the boost library. It is all about iterators. http://www.boost.org/doc/libs/1_59_0/libs/filesystem/example/simple_ls.cpp -rick
  8. What about using those esp8266 modules with the arduino core?
  9. I updated my original post: http://forum.43oh.com/topic/9873-ccs-for-999/ Sorry to all those who bought hardware they didn't really want to get a free license. I didn't know they were planning to change it. -rick
  10. Work in small steps, making small successes: 1.) Learn how to blink an led 2.) Learn how to print out to the serial port 3.) Learn how to read the digital value of a pin 4.) Learn how to read an analog value of a pin 5.) Read the value of 2 analog pins and print their values out. 6.) Google search for existing arduino solutions, concentrate on projects that are using a 3.3volt arduino (pro mini), at least those instructions won't fry your launchpad by using 5volts. Adjust the code and circuit to work with the ti launchpad Search: http://lmgtfy.com/?q=parallax+2+axis+joystick+arduino
  11. It makes me smile inside every time I can cut one of those proprietary TI hooks they use to hold me down. I'm so happy to be able to use open source software that ships with full source code. It always leads me to a deeper understand of how everything works and greater freedom to work on my choice of hardware now and in the future. I just loaded up some code and was able to upload and debug it using msp430-gcc, mspdebug, and msp430-gdb that I compiled on the raspberry pi without a trace of any TI software in sight. Thanks, -rick
  12. Did you happen to try this with any chips that also have SBW (2-wire JTAG)? It seems like the tst/rst toggle sequence might be different for them. I couldn't get any recent chips to respond to this. I tried with a msp430g2553 and a msp430fr5969. It doesn't want to let me connect. -rick
  13. Do you really know what I'm doing there? I don't think so. I'm setting P1.4 as output and turning on the SEL bit for it also. When those two registers are activated, it outputs the SMCLK on the P1.4 pin. How is that obvious? more obvious would be a function called: __attribute__((always_inline)) static void CPU_output_SMCLK() { P1DIR |= BIT4; P1SEL |= BIT4; } Oh yeah and that PORT/PIN/SEL setting combination is only for the msp430g2553, other chips output the clock on different ports and pins. How is just using the bare registers more readable? -rick
  14. BTW: that macro is missing parens around the ~pin ... should be ~(pin)
  15. I think that is probably a gcc only optimization (forcing always_inline). I'm not sure if you can do that with the ti version. What I find interesting about discussions like this is that I'm often wrong about what feels true in my gut and what is actually true. I'm sure I'm hampered by the fact I've been doing 'C' code now since 1982. I have a bag of personal biases that are often wrong with today's more capable compilers. Lucky for all of you, optimization technology has come a long way since the days of the pdp 11 -rick
  16. These all seem to generate the same sized code ... #include <msp430.h> #include <stdint.h> // MSP430 gpio macros #define GPIO_SEL(port) P ## port ## SEL #define GPIO_DIR(port) P ## port ## DIR #define GPIO_OUT(port) P ## port ## OUT #define GPIO_IN(port) P ## port ## IN #define GPIO_IS_INPUT(port,pin) { GPIO_SEL(port) &= ~(pin); GPIO_DIR(port) &= ~(pin); } #define GPIO_IS_OUTPUT(port,pin) { GPIO_SEL(port) &= ~(pin); GPIO_DIR(port) |= (pin); } #define GPIO_IS_PERIPHERAL_IN(port,pin) { GPIO_SEL(port) |= (pin); GPIO_DIR(port) &= ~(pin); } #define GPIO_IS_PERIPHERA
  17. did you try it without the Wire.write(1) ? Maybe some i2c device sees that and is waiting for more?
  18. i thought all those clones didn't have any logic buffers and are limited to 5v max? How is that going to work 20v signals?
  19. Energia has its own artificial limits with the msp432. There is already an issue logged asking to expose all the uarts. However, it does expose 2 serial ports.
  20. In the latest version this has probably changed: https://github.com/energia/tivac-core/blob/master/boards.txt#L35 EK_TM4C1294XL -rick
  21. If you look at the data sheet find the pins named UCA0TX UCA0RX ... UCA3TX UCA3RX. There are four hardware ones. I don't know which of these are actually pinned out on the launchpad board. But you should check. They are available for use.
  22. I can't say I've ever seen a UART with 24 bits of data. I have seen 9 bit but that was the max. Maybe you can use the spidev peripheral to send the data. I had some sample code that used spidev to send data that was actually a wave form for those ws2811 leds. https://github.com/RickKimball/beaglebone/tree/master/ws2811_spi_test -rick
  23. One major thing I forgot to mention was the resources consumed on the EP2C5. With all features enabled it only used about 30% of the logic elements on the chip. The memory sizes you configure determines how many of the M4K ram blocks are actually used. Here I used 4K for RAM and 4K for Code.
  • Create New...