Jump to content
43oh

larsie

Members
  • Content Count

    297
  • Joined

  • Last visited

  • Days Won

    7

Reputation Activity

  1. Like
    larsie reacted to oPossum in 24x16 text on VGA using Launchpad w/ G2553   
    This is derived from NTSC/PAL video text display using launchpad. video_vga.asm is a drop in replacement for video.asm.
     

     
    The sync timing is for 640x480 60 Hz VGA mode. A 330 ohm resistor must be used on all video lines (R/G/B) because they are analog signals with a max allowed voltage of about 1 volt. Only one of the R/G/B lines can be driven directly from the MSP430 due to current limitations. A buffer such as 74AHC125 could be used to drive all three if desired.
     
    Wiring

    Gnd ------------ Ground [5, 6, 7, 8, 10] P1.5 ----------- Vertical Sync [14] P1.6 ----------- Horizontal Sync [13] P1.7 ---[330]--- Video out (R [1], G [2] or B [3])
     
    video_vga.asm
    ;
    ; Copyright © 2011, 2012 Kevin Timmerman
    ;
    ; This program is free software: you can redistribute it and/or modify
    ; it under the terms of the GNU General Public License as published by
    ; the Free Software Foundation, either version 3 of the License, or
    ; (at your option) any later version.
    ;
    ; This program is distributed in the hope that it will be useful,
    ; but WITHOUT ANY WARRANTY; without even the implied warranty of
    ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    ; GNU General Public License for more details.
    ;
    ; You should have received a copy of the GNU General Public License
    ; along with this program. If not, see .
    ;
     
    .cdecls C, LIST, "msp430g2553.h"
     
    .text
    .def video_init ; void video_init(void); - Initialize video generation
    .def field_timer ; extern int field_timer; - Decremented at each vsync
    .def vblank ; Vertical blanking flag
    .ref text ; Text buffer
    .ref font ; Font 8 x 12, grouped by row
    ;
    ;
    .bss sync_state, 2 ; Sync state
    .bss sync_lines, 2 ; Lines until next sync state
    .bss video_state, 2 ; Video generation state
    .bss vblank, 2 ; Vertical blanking flag
    .bss field_timer, 2 ; Decrement at vsync
    .bss text_ptr, 2 ; Text buffer pointer
    .bss font_ptr, 2 ; Font pointer
     
     
    ; --- Ideal VGA 640 x 480 60 Hz Timing ---
    ; Pixel clock 25.175 MHz
    ; Horizontal 31.47 kHz (pix / 800, negative sync)
    ; Vertical 59.94 Hz (pix / 420000, negative sync)
    ; - Horizontal timing (line)
    ; Scanline part Pixels Time [
  2. Like
    larsie got a reaction from YanuarPrijadi in Motor/Boosterpack for L298 and servos   
    I must admit I
    RobotBooster_mini_v1.zip
  3. Like
    larsie got a reaction from turd in Motor/Boosterpack for L298 and servos   
    I must admit I
    RobotBooster_mini_v1.zip
  4. Like
    larsie got a reaction from CorB in Laser cut box for launchpad   
    I tested the acrylic with capacitative touch, and it worked right through the plastic, so bundling with a boosterpack could be quite cool.
  5. Like
    larsie got a reaction from rbasoalto in Motor/Boosterpack for L298 and servos   
    I must admit I
    RobotBooster_mini_v1.zip
  6. Like
    larsie got a reaction from Nytblade in Laser cut box for launchpad   
    Yes, it's just like a printer driver. You can print from Word or some other program. I use InkScape, which is a free opensource drawing program. Then inside the printerdriver (a separate program), you choose either raster mode, which takes the picture and burns it into the material, or vector-mode which cuts through the plate. You can choose which colours should be which power/speed levels, so some colours can burn right through and some can just 'draw' lines.
     
    There are online services where you can order designs. For example Ponoko.com or even Seeedstudio. I might also try to make some stuff that I sell, to try to recover some of the cost of the machine... which is at you say rather expensive, but still cheaper than the professional versions.
  7. Like
    larsie reacted to alsenin in WS6318 GSM Booster Pack   
    Okay. There is the yet another LP booster pack. It is for communication over GSM network.



     

    Now I have several working prototypes. PCB has couple of bugs but booster pack has full functionality. Soon, I will correct all the errors and give a full description. Schematic is in the attachment. If anyone suggest any modification or expansion of the functionality - this is a chance to introduce them into the final PCB tracerouting.
    WS6318.pdf
  8. Like
    larsie got a reaction from reagle in Laser cut box for launchpad   
    So every cool platform needs a laser cut acrylic box (apparently). I
  9. Like
    larsie got a reaction from CorB in Laser cut box for launchpad   
    So every cool platform needs a laser cut acrylic box (apparently). I
  10. Like
    larsie got a reaction from djun in Laser cut box for launchpad   
    So every cool platform needs a laser cut acrylic box (apparently). I
  11. Like
    larsie reacted to energia in Up we go   
    I would like to dedicate my first post on this forum to all the Energia team members who have supporting me in the first hours of the project. Without their support Energia would not have been possible.
     
    A special thanks to Rei Vilo and Rickta59 for their invaluable contribution.
     
    robertinant
  12. Like
    larsie got a reaction from oPossum in Surface mount stencils   
    I've now got my laser cutter up and running and have tested making surface mount stencils. It seems to work pretty well, though I haven't pushed the boundaries on really tiny components. If someone has a cool project you want surface mount stencils for, I can make some for free (at least for the first projects). Only a couple of dollars in shipping. The condition is that it's an open source design that you document on this forum.
     
    Here is a picture of the stencil I used to test the power levels. The succesful one is the one with a black circle around it.
     

     
    Here's a video of using surface mount stencils. I'm using them for the LCD display I'm producing, and it has really helped increase the quality and speed of production. Now I just need a pick'n place machine and a reflow oven.
     

     


  13. Like
    larsie got a reaction from RobG in Surface mount stencils   
    I've now got my laser cutter up and running and have tested making surface mount stencils. It seems to work pretty well, though I haven't pushed the boundaries on really tiny components. If someone has a cool project you want surface mount stencils for, I can make some for free (at least for the first projects). Only a couple of dollars in shipping. The condition is that it's an open source design that you document on this forum.
     
    Here is a picture of the stencil I used to test the power levels. The succesful one is the one with a black circle around it.
     

     
    Here's a video of using surface mount stencils. I'm using them for the LCD display I'm producing, and it has really helped increase the quality and speed of production. Now I just need a pick'n place machine and a reflow oven.
     

     


  14. Like
    larsie reacted to cde in i2c Explorer   
    NOTE: This was built using IAR, for an msp430 with the USI peripheral. It will need editing to work on USCI peripherals or if compiled in CCS or GCC.
    Updated 12/12/12: http://forum.43oh.com/topic/126-i2c-explorer/?p=25918
     

    I like i2c, and have one main project I want to create based on turning a scrolling led display into a computer/net/micro controller accessible one (it has an i2c eeprom, and its original mc is still in use).

    Having gotten the launchpad, it was one step closer to completion. The next step was getting i2c protocol working and such. With the builtin USI of the launchpad, and Joby's SPI explorer (which uses NJ's uart to boot), I was able to make an i2c Explorer.

    It uses the UART code without modification (except that I am using IAR instead of mspgcc or CCS) and modified Joby's command processing, with the i2c USI built from scratch.

    There are a handful of commands.
    [- i2c START
    bx or 0bx- Transmit Binary number
    hx or 0x- Transmit Hex number
    x- Transmit Decimal number
    r read with Acknowledge (Ack)
    n read with No-Acknowledge (Nack)
    s Search for i2c Slaves
    ]- i2c STOP

    Nearly the same commands as the buspirate/busninja/spi-explorer. I broke out the nack read because it was easier, allows more control, and not all i2c slaves want/expect a nack on the last read.

    It is not completely refined. Still some stuff that needs to be removed/polished (Slave search should only output on responded addresses, instead of needing someone to search through all 255 address tests responses.)

    Bus speed is non-standard as far as I can see (USI Clock is SMCLK at 1mhz, divided at 128 as per TI's USI application note. 1mhz/128 = 7812hz = ~8khz???) This needs to be fixed, and a TI introduction to USI/USCI powerpoint shows that the bus can be driven at 500khz at 1mhz clock. Probably just needs the correct divider selection (Divide clock by 2 for 500k (400k i2c speed) or by 8 for 125k (100k i2c speed).

    This is beta/preliminary release. Only been tested with a PCF8574. Code clocks in at 1920 bytes, with no optimization (Standard IAR project with no defaults changed). UART at 9600 like normal, pin 1.7 is sda, pin 1.6 is scl (can't be changed due to USI so remove the p1.6 led jumper) and p1.0 is a status light.

    Will be testing with faster speed and more i2c devices soon.
    i2c.zip
  15. Like
    larsie reacted to CorB in MSP430 meets LaCrosse Temperature/Humidity sensor TX3TH   
    Hi,
     
    Excuses for the long post !!
     
    After I found out that I could detect signals in the 433Mhz band using an AIR Boosterpack (See viewtopic.php?f=9&t=2944 AIR Boosterpack RF spectrum display) I wanted to display the data I was receiving on the 433 Mhz band.
    Ive got a Lacrosse temperature/humidity logger WS8610 that can read up to 3 external sensors and log the data. These sensors broadcast their data every minute or so.
     
    Since I have a logger and I have a display you might ask why do you want to read the data ? My motivation for this is simple, the datalogger can only capture data for about 1.5 weeks and then the oldest readings are overwritten and I need to connect the datalogger to an old PC (that still has a USB-DB9 connector) to be able to store the data. If I can read the data directly from the sensors I can hook them up in a system I allready have running with several other sensors (gas, electricityusage, inside temperature) and store the data on the internet. For those that are interested I am using Thingspeak to store my data.
     
    So last week I started to look at a way to decode the signals I saw coming in using my spectrum display. Luckily other people had allready done a lot of work on the protocol used by the sensors. The sensordata is send using On/Off keying (OOK).
    See http://ftp.f6fbb.org/domo/sensors/tx_signals.php and http:/ftp.f6fbb.org/domo/sensors/tx3_th.php
     
    After a few days of trial-and-error approach (thanks go to larsie for the feedback and ideas !) I actually was getting signals that could be the sensordata. To cut a long story short, using asynchronous CarrierSense detection on the AIR BOOSTERPACK and timing the length of the pulse coming in I can read the incoming data from several sensors. The software is definitely in its alpha stages. I can read one sensor properly but reading multiple sensors does give problems, if I set the RF registers to read the nearby sensor (3-4 meters away) the far away sensor (>10m) doesnt get picked up. When I set to register to read the far away, the nearby gets picked up but the data isnt as it should be anymore.
     
    Here's an image to show that I get results that are the same as my LaCrosse display shows (from left to right : MSP430 sandwich, Lacrosse display and a not active TX3TX sensor).
     

     
    The code below is based on the same GLCD and TI libraries as I used for my spectrum display project.
     
    regards
    CorB
     
     

    /* * This file is licensed under BSD. The simplicity code is originally copyright Texas Instruments, * but has been adapted by Lars Kristian Roland/Cor Berrevoets * the glcd code is by Lars Kristian Roland/Cor Berrevoets * the tx3th sensor information can be found at http://ftp.f6fbb.org/domo/sensors/tx3_th.php * the sensor first sends temperature information consisting of 11 blocks of 4 bits repeated once * the sensor secondly sends humidity information consisting of 11 blocks of 4 bits repeated once * block 0 is 0000 * block 1 is 1010 (preamble) * block 2 is sensortype 0=temperature E=humidity * block 3 is 4 bits sensorID * block 4 is 3 bits sensorID and another bit (unknown purpose) * block 5/6/7 is temperature in tenths degrees BCD +50 degrees * block 5/6/7 is humidity in tenths percent BCD (always ending at 0) * block 8 = block 6 * block9 = block 7 * block10 = CRC * */ //******************************************************************* // // G2553 // // ----------------- // | | // |VCC GND | // S1/GDO2 |P1.0 P2.6|-RF-GDO0 // S2 |P1.1 P2.7|-RF-CS // SW1 |P1.2 | // LED |P1.3 | // glcd-cs |P1.4 P1.7|<-------| glcd/RF-MISO //glcd/RF-CLK |P1.5 P1.6|------->| glcd/RF-SOMI // S3 |P2.0 P2.5| // S4 |P2.1 P2.4| // |P2.2 P2.3| // | | // ----------------- //******************************************************************* #include "ti/include.h" #include "../library/glcd_charset.c" #include "../library/glcd.c" unsigned long clockcnt=0,lastclock=0; unsigned long lastpulsecnt, pulsecnt=0,faultcount=0, pulselength=0; unsigned char bit; // bitcounter 0..3 unsigned char bitdata[4]={8,4,2,1}; // to create a nibble readout with MSB first coming in char pulseindx; // nibblecounter unsigned char pulsetrain[50],oldpulse[50]; // datapackage storage unsigned char line=4; // display of temperature datapackage int rssi; #define signal BIT2 void setup433MhzOOKreader() { TI_CC_SPIStrobe(TI_CCxxx0_SIDLE); // set IDLE TI_CC_SPIWriteReg(TI_CCxxx0_FREQ2, 0x10); // Freq control word, high byte TI_CC_SPIWriteReg(TI_CCxxx0_FREQ1, 0x00); //Freq control word, mid byte. TI_CC_SPIWriteReg(TI_CCxxx0_FREQ0, 0x00); //Freq control word, low byte. TI_CC_SPIWriteReg(TI_CCxxx0_MDMCFG4, 0x06); // RX bandwidth and datarate MSB TI_CC_SPIWriteReg(TI_CCxxx0_MDMCFG3, 0x37); // datarate LSB TI_CC_SPIWriteReg(TI_CCxxx0_MDMCFG2, 0x00); // no preamble/sync TI_CC_SPIWriteReg(TI_CCxxx0_MDMCFG1, 0x00); // CHANNEL SPACING and channelspacing MSB TI_CC_SPIWriteReg(TI_CCxxx0_MDMCFG0, 0xe5); // x2E5=200Khz x1E5=100Khz x0E5=50Khz x000=25Khz, CHANNEL SPACING LSB TI_CC_SPIWriteReg(TI_CCxxx0_FOCCFG, 0x00); // no IF compensation for OOK TI_CC_SPIWriteReg(TI_CCxxx0_AGCCTRL2,0xc3); // receiver gain 0xAB A B TI_CC_SPIWriteReg(TI_CCxxx0_PKTCTRL0, 0x32); //asynchronous mode TI_CC_SPIWriteReg(TI_CCxxx0_IOCFG0, 0x0E); //GDO0Output Pin Configuration asynchronous output TI_CC_SPIWriteReg(TI_CCxxx0_CHANNR, 48); // change radio to channel 48 in 432Mhz band (50khz spacing) TI_CC_SPIStrobe(TI_CCxxx0_SRX); // goto receivermode } void main (void) { WDTCTL = WDT_MDLY_0_064; // WDT ~0.064ms interval timer IE1 |= WDTIE; // Enable WDT interrupt P1DIR |=signal; TI_CC_GDO0_PxIES &= ~TI_CC_GDO0_PIN; // Int on falling edge (end of pkt) TI_CC_GDO0_PxIFG &= ~TI_CC_GDO0_PIN; // Clear flag for GDO0 TI_CC_GDO0_PxIE |= TI_CC_GDO0_PIN; // Enable interrupt on end of packet RF_init(); // SETUP ANAREN AIR RF __delay_cycles(50000); SPISetup(); // Initialize SPI Display __delay_cycles(100000); clear(); __delay_cycles(100000); //reset the pulsetrain indices and storage arrays for (pulseindx=0; pulseindx<49; pulseindx++) { pulsetrain[pulseindx]=0; oldpulse[pulseindx]=0; } pulsecnt=0; pulseindx=0; bit=0; lastpulsecnt=0; writeInt(0,2,faultcount,3); // display faults writeInt(48,2,pulsecnt,3); // display how many packages have been read setup433MhzOOKreader(); __enable_interrupt(); // enable all interrupts while (1) // do for ever { if (pulsecnt>lastpulsecnt) // display data only of we have received a package { setcharmode(1); // switch to large characters if ((oldpulse[1]==0x0a) && (oldpulse[12]==0x0a)) { unsigned int temperature; unsigned int humidity; temperature=(oldpulse[5]-5)*100+oldpulse[6]*10+oldpulse[7]; writeInt(0,0,temperature,3); humidity=oldpulse[27]*10+oldpulse[28]; writeInt(48,0,humidity,3); lastpulsecnt=pulsecnt; } writeInt(0,2,faultcount,3); // display faults writeInt(48,2,pulsecnt,3); // display how many packages have been read setcharmode(0); // switch to small characters unsigned char temp; char i,x; x=0; // show the 11 nibbles of the temperature part of the package for (i=0; i<11; i++) { temp = oldpulse[i]; temp += (temp > 9) ? 'A' - 10 : '0'; writeChar(x,line,temp); x=x+6; } writeInt(x+6,line,rssi,4); } } } #pragma vector = WDT_VECTOR // - Watchdog timer interrupt vector __interrupt void wdt_isr(void) // This interrupt will occur once per second { // clockcnt++; } #pragma vector=PORT2_VECTOR __interrupt void Port_2(void) { // REALLY cheap debounce. // We can get away with this because we're edge triggering but reading the level. if(TI_CC_GDO0_PxIFG & TI_CC_GDO0_PIN) { pulselength=clockcnt-lastclock; lastclock=clockcnt; if (pulselength<30) {pulsetrain[pulseindx]|=bitdata[bit];} bit++; if (bit==4) {bit=0; pulseindx++;} if (pulseindx>43) // we got all 44 bits in { rssi=TI_CC_SPIReadStatus(TI_CCxxx0_RSSI); __delay_cycles(100); if(rssi < 128) // convert RSSI readout to dB { rssi = -((rssi/2) - 74); } else{ rssi = -(((rssi - 256)/2) - 74); } char j; for (j=0; j<45; j++) {oldpulse[j]=pulsetrain[j]; pulsetrain[j]=0; } //reset indices pulseindx=0; bit=0; //increment the line to display the datapackage line++; if (line>7) {line=4;} if (oldpulse[1]==0x0a) {pulsecnt++;} else {faultcount++; pulsecnt++;} // add a long delay after reading the 44th nibble, corrects possible mistakes also __delay_cycles(10000000); } TI_CC_GDO0_PxIFG &= ~TI_CC_GDO0_PIN; // After pkt RX, this flag is set. } }
  16. Like
    larsie reacted to username in MSP430 PC GUI Eval Tool   
    Hey all,
     
    I was working on a GUI that would be able to control any and all functions on a particular MSP430 processor from a PC GUI. Only limitations a course would be P1.1 and P1.2 which are required for GUI communication. This is very very very much so a work in progress. Currently i'm writing it using WX Widgets libraries to simplify the GUI aspect of it. However, currently i'm not using a "form builder" so it is going to take a handy amount of time to write. Good c++ experience though....
     
    This GUI would be very handy to have from a hardware/software test debug standpoint. For example, say I wanted to test out some SPI sensor I purchased, I could use a GUI such as this to send custom SPI packets to the device i'm testing and read/observe results live. That as opposed to having to write a micro.c file to do the communication and re write it every time something doesn't work.
     
    Many thanks to rick and suggaraddict for assistance on c++ coding help
     
    GUI Download Rev 0.5 : https://github.com/NateZimmer/MSP430-Ev ... I_EVAL.exe (windows.exe, click "view raw" to download)
    (feedback on whether or not it works for you would be great. Gaurenteed to work with a FTDI RS232 -> USB. However, launchpad drivers suppperr flakey and crapey )
     
    Remember to flash https://github.com/NateZimmer/MSP430-Ev ... er/GUI.cpp to your MSP430G2553
     
    Source Code is now at https://github.com/NateZimmer/MSP430-Eval-Tool
     
    (your going to need to download and BUILD the wx libraries to get this to work)
     
    Main Connect tab: Implemented
     

     
    Digital Output tab: Implemented
     

     
    Digital Input tab: Implemented
     

     
    SPI Tab: Implemented but not fully tested
     

     
    Analog Input tab: In Progress
     
    Connection Issue Debug
    1. Make sure you got a Rev1.5 launchpad with a G2553 micro flashed with the proper code provided. Also, makesure your jumpers are set to hardware uart.
     
    2. If that doesn't work... sadly, the TI RS232 <-> USB sucks hardcore compared to FTDI that always works. Once a connection is established, it works fine. However, getting that first connection can be a super pain. If your having connection issues, open up a terminal program(such as putty), connect to the com port of your msp430, and press the "1" key and ONLY the 1 key. If your msp430 is working properly you should receive "PING" back. At that point, close the terminal program and open up my .exe program. At that point, it should connect fine.
  17. Like
    larsie reacted to username in AR Drone Control V2   
    Howdy all,
     
    Got another video with my AR Drone. This time the MSP430 was used for alittle bit more then just acting as a remote. With the MSP430G2553, the W5200, and a wireless switch, I was able to control it from an isolated embedded system. Once I have abit more time i'll implement a pair of joysticks to control the drone. As for how it works, the MSP430 sends SPI data to the W5200, then the W5200 sends UDP commands to the drone. Took abit of time to figure out how to fly the thing. Constant communication must occur with the drone or else its crashes (gotta love darn WDTs). Theres also a rather tedious initialization sequence that you gotta do on startup. Anyhow, heres a video:
     



     
    Special thanks to Rob G for his awesome W5200 driver code.
    You can see his thread for his W5200 project here: viewtopic.php?f=35&t=2529&start=110
     
    Cheers!
    -Nate Zimmerman
  18. Like
    larsie reacted to jsolarski-backup in parallax rfid reader + back door   
    This is a project I have finished recently. Since I am lazy and didn't feel the need to use keys to access my apartment I decided to hook up an rfid reader to my back door, which in turn will open my breaker bar on my patio door.
    It is sorta of a kludge till I can find a stepper motor to replace my rube goldberg~esqe like device.
     
    How it lifts the breaker bar, it uses a solenoid to pull a large ball bearing that is attached to a string, that goes through a screw eye, then it attaches to the breaker bar.
    when the correct card is scanned it pulls on the balanced ball bearing, which it will then pull on the breaker bar to unlock the patio door.
     
    I use a overkill atx power supply to power everything, 12v for the solenoid, 5v for the rfid reader, and 3.3v to power the msp430. Since I have about 5 more atx power supplies sitting around, its not really a waste, just getting use out of something that taking up space in a closet.
     
    Please ignore all the ScotchLoks that I use. They are one of the best way to connect 2 wires together, and also having 2 bulk containers(2 wire and 3 wire, cnt 500), makes using them a no brainer on projects or other repairs.
     
    http://justinstech.org/2012/07/rfid-back-door-easy-access/
     
    In the video, I am using the older code before I put the reset code in, so I had to manually reset the device every time the card was scanned.


     
    I am sure that the code can be improved but it works quite well at this time. It has been tested for the past few weeks with out issues. I know my delay kludge could be improved by use of the time but this leaves options open for upgrades at a later date (like adding a stepper motor).
     
    code http://justinstech.org/wp-content/uploads/2012/07/main.c
     

    //****************************************************************************** // MSP430F20xx Demo - Timer_A, Ultra-Low Pwr UART 2400 Echo, 32kHz ACLK // M. Buccini / L. Westlund // Texas Instruments Inc. // October 2005 // Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.40A //****************************************************************************** // // This code has been modified to work with the parallax RFID reader for 2400 baud // It works and all but needs improvment. // Modifications By Justin Solarski // built with MSPGCC and a Text editor...CCE and IAR specific code commented out. // or removed. Delay may not work on CCE or IAR please use built in delay cycles. // Changed from running on the aclk/32K crystal to 8Mhz // removed all TX code because its not needed // // MSP430F20xx // ----------------- // /|\| XIN|- // | | | // --|RST XOUT|- // | | // | p1.7 |------\/\/>100ohm--->tip120 to solonoid // | | 2400 8N1 // | CCI0A/RXD/P1.1|<---------paralax RFID reader // #include //#include //for string comparison //string comparison failed do to non charactors in string........... #define RXD 0x02 // RXD on P1.1 // Conditions for 2400 Baud SW UART, ACLK = 32768 #define Bitime_5 1667 // old = 0x06 ~ 0.5 bit length + small adjustment #define Bitime 3333 // 0x0E = old aclk val 427us bit length ~ 2341 baud e=14 //****************************************************************************** unsigned int RXTXData; unsigned char BitCnt; unsigned char rfidtag[12]; unsigned int tagcnt = 0; unsigned char tag1[12] = {0x0a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0d}; //tag replaced by 0xff for security reasons, I doubt any one wants to break into my place // but just in case they do, they will have to do it the hard way. //****************************************************************************** void RX_Ready (void); void __inline__ msp_delay(register unsigned int n); void Check_rfid(void); //****************************************************************************** void main (void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_8MHZ; // Set range DCOCTL = CALDCO_8MHZ; // Set DCO step + modulation */ TACTL = TASSEL_2 + MC_2; // ACLK, continuous mode // tassel_1 =aclk tassel_2 = smclk P1SEL = RXD; // // P1DIR |= BIT0 + BIT7; P1OUT |= BIT0; P1OUT &= ~BIT7; //****************************************************************************** // Mainloop for (; { RX_Ready(); // UART ready to RX one Byte _BIS_SR(LPM0_bits + GIE); // Enter LPM3 w/ interr until char RXed //****************************************************************************** //when all 12 chars are recieved if ( tagcnt == 12) { Check_rfid(); } else { rfidtag[tagcnt] = RXTXData; tagcnt++; } } } //****************************************************************************** //check if RFID matches known rfid void Check_rfid(void) { unsigned char flag; unsigned int i; while(1) { for(i=0; i<12; i++) { if (rfidtag[i] == tag1[i]) // check tag against one in memory. { flag = 0x01; } //end if else { flag = 0x00; // moved to flag code 0x00, it was redundant to put reset code here // for(i=0; i<12; i++) //incoming data reset to 0 // { // rfidtag[i] = 0; // } // moved to flag code 0x00, it was redundant to put reset code here // tagcnt = 0; // WDTCTL = WDT_MRST_32; //reset msp430 after read and execute // while(1){ msp_delay(50000); } } //end else } //end for if (flag == 0x01) { P1OUT |= BIT7; msp_delay(50000); //delay kludge msp_delay(50000); msp_delay(50000); msp_delay(50000); msp_delay(50000); msp_delay(50000); msp_delay(50000); msp_delay(50000); //end of delay kludge for(i=0; i<12; i++) { rfidtag[i] = 0; } P1OUT ^= BIT7; tagcnt = 0; WDTCTL = WDT_MRST_32; //reset msp430 after read and execute while(1){ msp_delay(50000); } } //end if if (flag == 0x00) { for(i=0; i<12; i++) { rfidtag[i] = 0; } tagcnt = 0; WDTCTL = WDT_MRST_32; //reset msp430 after not the correct tag while(1){ msp_delay(50000); } } } //end while } //****************************************************************************** // delay loop used for mspgcc, if using IAR or CCE please replace with delay cycles void __inline__ msp_delay(register unsigned int n) { __asm__ __volatile__( " 1: \n" " dec %[n] \n" " jne 1b \n" : [n] "+r"(n)); } //****************************************************************************** // Function Readies UART to Receive Character into RXTXData Buffer void RX_Ready (void) { BitCnt = 0x8; // Load Bit counter CCTL0 = SCS + OUTMOD0 + CM1 + CAP + CCIE; // Sync, Neg Edge, Cap } //****************************************************************************** // Timer A0 interrupt service routine //#pragma vector=TIMERA0_VECTOR //__interrupt void Timer_A (void) __attribute__((interrupt(TIMERA0_VECTOR))) void CCR0_ISR(void) { CCR0 += Bitime; // Add Offset to CCR0 if( CCTL0 & CAP ) // Capture mode = start bit edge { CCTL0 &= ~ CAP; // Switch from capture to compare mode CCR0 += Bitime_5; } else { RXTXData = RXTXData >> 1; if (CCTL0 & SCCI) // Get bit waiting in receive latch RXTXData |= 0x80; BitCnt --; // All bits RXed? if ( BitCnt == 0) //>>>>>>>>>> Decode of Received Byte Here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< { CCTL0 &= ~ CCIE; // All bits RXed, disable interrupt _BIC_SR_IRQ(LPM0_bits); // Clear LPM3 bits from 0(SR) } //>>>>>>>>>> Decode of Received Byte Here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< } }
     
    If you have any suggestions, questions or criticism please let me know
     
    **edit**
    there are pictures of the each component on my blogpost that is linked above
  19. Like
    larsie reacted to oPossum in Volt/Amp/Watt meter   
    This is a simple voltage and current meter that uses the TI INA219 chip. Voltage measurement range is 0 to 26 volts with 4 mV resolution and current measurement range is -4 to +4 amps with 1 mV resolution (when using a 0.01 ohm shunt). The specs are inferior to a pair of quality multimeters, but it is a fraction of the price and shows wattage in addition to voltage and current. The Nokia 5110 display is used so the firmware could be enhanced to do simple graphing. Sending the measurements to a computer could also be done.
     
    Using the INA219 makes for a very simple circuit.

     
    The normal display is three lines with voltage, amperage and wattage.

     
    Pressing the P1.3 switch will show the 6 registers in the INA219 in hex and signed decimal.

     
    The code is written in C++ and uses templates for the LCD, IIC and INA219. Software SPI and IIC is used for maximum portability.
    vam.zip
  20. Like
    larsie got a reaction from CorB in AIR Boosterpack RF spectrum display   
    Cool project. Thanks
     
    For OOK you may be able to look at the Carrier Sense and define CS as an output on the output pin of the Cc1101. There is also a separate mode for the cc1101 that turns off packet control (synchronous mode??? ) which is used for this sort of thing. The cc1101 is designed as a very flexible chip to replace old tech implementations for sensors, garage openers etc.
     
    There is an ook mode also, and you can use smartrf studio to get the right parameters. Then the first powerlevel configs are used to say if it shiuld be ask or ook. But in this case you need to know the bitrate, and the protocol needs to have same length of on and off bits. Many of the protocols use length of the pulse to indicate low and high, which makes CS a good option I think.
  21. Like
    larsie reacted to CorB in AIR Boosterpack RF spectrum display   
    Hi all,
     
    One of the things I wanted to build using the Anaren AIR boosterpack was a mini spectrum "analyzer" or spectrum display. During my holiday i found time to play around with both the AIR boosterpack and the LCD module Lars has produced.
     
    Although the AIR boosterpack was designed for 868/915 Mhz it seems the receiver inside (CC110L) is sensitive also in the 433Mhz region. The code I share with this mail allows the user (by changing a define) to switch between 3 frequencybands. Two buttons of the LCD package allow change of RX bandwidth and channelwidth.
     
    THe screenshot below shows a typical readout in the 433 Mhz band in a room where a Lacross TX3TH temperature/humidity sensor is sending data every minute using an OOK protocol (Request: if anybody knows how to receive/decode OOK using a CC110L please inform me). The display shows the low and high frequency in Mhz and shows the frequency with the highest readout (RSSI in dB) in kHz and as a blinking line in the graph.
     

     
    If you want to know more about this mini spectrum display or have other comments, feel free to share them.
     
    regards
    CorB
    spectrum.zip
    glcd.zip
  22. Like
    larsie reacted to RobG in Ethernet Booster Pack   
    [EDIT] The newest version of this BP is here
     
    [EDIT] This project is finished
    Available in the 43oh Store.

    This is still in it's early phase, so I need your input.

    Here are some specs so far:
    1. WIZnet's W5200 Ethernet controller chip (W5100 or W5300 is an option.)
    2. MagJack
    3. LDO + power header
    4. Opto isolators (2 or more) + output header
    5. Input/output header for switches/keypad/display
    6. DIP or SMD MSP430G

    I have decided to use W5200 because...
    "W5200 chip is a Hardwired TCP/IP embedded Ethernet controller that enables easier internet connection for embedded systems using SPI (Serial Peripheral Interface). The W5200 is composed of a fully hardwired market-proven TCP/IP stack and an integrated Ethernet MAC & PHY. Hardwired TCP/IP stack supports TCP, UDP, IPv4, ICMP,
    ARP, IGMP, and PPPoE. By using W5200, users can implement the Ethernet application they need by using a simple socket
    program instead of handling a complex Ethernet Controller."

    In other words, you do not have to deal with or waste resources on TCP/IP stack.

    The board could be used as a booster pack or free standing, hence MSP430G and LDO.
    The total cost should be around $10 or less.

    Few decisions I have to make:
    2 or more opto couplers?
    DIP, SMD or both (MSP430G?)

    Any suggestions?


  23. Like
    larsie reacted to cde in How to power a board   
    Most 3.3v will run at 3.0v as a recommended minimum, but can run a bit lower as well, the manufacturer just won't support undervolting it, you can always just try it.
     
    That tps61097-33 is a good idea as it only needs two caps and a common inductor, but only gives you about 100ma. Microchip MCP1253 is similar, but needs no inductor, can provided 3.3 or 5v out and 120ma.
  24. Like
    larsie reacted to MishoOo in MSP430 UART   
    Here is the modified code that i used to controll 2 H-Bridges with the launchpad:
     

    //****************************************************************************** // MSP430G2xx2 Demo - Timer_A, Ultra-Low Pwr UART 9600 Echo, 32kHz ACLK // // Description: Use Timer_A CCR0 hardware output modes and SCCI data latch // to implement UART function @ 9600 baud. Software does not directly read and // write to RX and TX pins, instead proper use of output modes and SCCI data // latch are demonstrated. Use of these hardware features eliminates ISR // latency effects as hardware insures that output and input bit latching and // timing are perfectly synchronised with Timer_A regardless of other // software activity. In the Mainloop the UART function readies the UART to // receive one character and waits in LPM3 with all activity interrupt driven. // After a character has been received, the UART receive function forces exit // from LPM3 in the Mainloop which configures the port pins (P1 & P2) based // on the value of the received byte (i.e., if BIT0 is set, turn on P1.0). // ACLK = TACLK = LFXT1 = 32768Hz, MCLK = SMCLK = default DCO // //* An external watch crystal is required on XIN XOUT for ACLK *// // // MSP430G2xx2 // ----------------- // /|\| XIN|- // | | | 32kHz // --|RST XOUT|- // | | // | CCI0B/TXD/P1.1|--------> // | | 9600 8N1 // | CCI0A/RXD/P1.2|<-------- // // D. Dang // Texas Instruments Inc. // December 2010 // Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10 //****************************************************************************** #include "msp430g2452.h" //------------------------------------------------------------------------------ // Hardware-related definitions //------------------------------------------------------------------------------ #define UART_TXD 0x02 // TXD on P1.1 (Timer0_A.OUT0) #define UART_RXD 0x04 // RXD on P1.2 (Timer0_A.CCI1A) //------------------------------------------------------------------------------ // H-Bridge Transistors Definitions //------------------------------------------------------------------------------ #define LEFT BIT3 //P2.3 #define RIGHT BIT4 //P2.4 #define BCK BIT5 //P2.5 #define FWD BIT6 //P1.6 //------------------------------------------------------------------------------ // Conditions for 9600 Baud SW UART, SMCLK = 1MHz //------------------------------------------------------------------------------ #define UART_TBIT_DIV_2 (1000000 / (9600 * 2)) #define UART_TBIT (1000000 / 9600) //------------------------------------------------------------------------------ // Global variables used for full-duplex UART communication //------------------------------------------------------------------------------ unsigned int txData; // UART internal variable for TX unsigned char rxBuffer; // Received UART character //------------------------------------------------------------------------------ // Function prototypes //------------------------------------------------------------------------------ void TimerA_UART_init(void); void TimerA_UART_tx(unsigned char byte); void TimerA_UART_print(char *string); //------------------------------------------------------------------------------ // main() //------------------------------------------------------------------------------ volatile unsigned int flagFWD=0, flagBACK=0; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer DCOCTL = 0x00; // Set DCOCLK to 1MHz BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; P1OUT = 0x00; // Initialize all GPIO P1SEL = UART_TXD + UART_RXD; // Timer function for TXD/RXD pins P1DIR = 0xFF & ~UART_RXD; // Set all pins but RXD to output P2OUT = 0x00; P2SEL = 0x00; P2DIR = 0xFF; __enable_interrupt(); TimerA_UART_init(); // Start Timer_A UART TimerA_UART_print("Mihai Tautu FILS - 2012\r\n"); TimerA_UART_print("Verbindung erstellt\r\n"); for (; { // Wait for incoming character __bis_SR_register(LPM0_bits); if(rxBuffer == 0x77) //w sent from keyboard { TimerA_UART_print("goForward\r\n"); P2OUT &= ~(BCK | LEFT | RIGHT); P1OUT |= FWD; flagFWD = 1; flagBACK = 0; } if(rxBuffer == 0x73) //s sent from keyboard { TimerA_UART_print("goBack\r\n"); P1OUT &= ~FWD; P2OUT &= ~(LEFT | RIGHT); P2OUT |= BCK; flagFWD = 0; flagBACK = 1; } if(rxBuffer == 0x61) //a sent from Keyboard { P2OUT &= ~RIGHT; P2OUT |= LEFT; if(flagFWD == 1) TimerA_UART_print("goForward+Left\r\n"); else if(flagBACK == 1) TimerA_UART_print("goBack+Left\r\n"); else TimerA_UART_print("goLeft\r\n"); } if(rxBuffer == 0x64) //d sent from Keyboard { P2OUT &= ~LEFT; P2OUT |= RIGHT; if(flagFWD == 1) TimerA_UART_print("goForward+Right\r\n"); else if(flagBACK == 1) TimerA_UART_print("goBack+Right\r\n"); else TimerA_UART_print("goRight\r\n"); } if(rxBuffer == 0x78) //x { TimerA_UART_print("STOP\r\n"); P1OUT &= ~FWD; P2OUT &= ~(RIGHT | BCK | LEFT); flagFWD = 0; flagBACK = 0; } // Echo received character //TimerA_UART_tx(rxBuffer); } } //------------------------------------------------------------------------------ // Function configures Timer_A for full-duplex UART operation //------------------------------------------------------------------------------ void TimerA_UART_init(void) { TACCTL0 = OUT; // Set TXD Idle as Mark = '1' TACCTL1 = SCS + CM1 + CAP + CCIE; // Sync, Neg Edge, Capture, Int TACTL = TASSEL_2 + MC_2; // SMCLK, start in continuous mode } //------------------------------------------------------------------------------ // Outputs one byte using the Timer_A UART //------------------------------------------------------------------------------ void TimerA_UART_tx(unsigned char byte) { while (TACCTL0 & CCIE); // Ensure last char got TX'd TACCR0 = TAR; // Current state of TA counter TACCR0 += UART_TBIT; // One bit time till first bit TACCTL0 = OUTMOD0 + CCIE; // Set TXD on EQU0, Int txData = byte; // Load global variable txData |= 0x100; // Add mark stop bit to TXData txData <<= 1; // Add space start bit } //------------------------------------------------------------------------------ // Prints a string over using the Timer_A UART //------------------------------------------------------------------------------ void TimerA_UART_print(char *string) { while (*string) { TimerA_UART_tx(*string++); } } //------------------------------------------------------------------------------ // Timer_A UART - Transmit Interrupt Handler //------------------------------------------------------------------------------ #pragma vector = TIMER0_A0_VECTOR __interrupt void Timer_A0_ISR(void) { static unsigned char txBitCnt = 10; TACCR0 += UART_TBIT; // Add Offset to CCRx if (txBitCnt == 0) { // All bits TXed? TACCTL0 &= ~CCIE; // All bits TXed, disable interrupt txBitCnt = 10; // Re-load bit counter } else { if (txData & 0x01) { TACCTL0 &= ~OUTMOD2; // TX Mark '1' } else { TACCTL0 |= OUTMOD2; // TX Space '0' } txData >>= 1; txBitCnt--; } } //------------------------------------------------------------------------------ // Timer_A UART - Receive Interrupt Handler //------------------------------------------------------------------------------ #pragma vector = TIMER0_A1_VECTOR __interrupt void Timer_A1_ISR(void) { static unsigned char rxBitCnt = 8; static unsigned char rxData = 0; switch (__even_in_range(TA0IV, TA0IV_TAIFG)) { // Use calculated branching case TA0IV_TACCR1: // TACCR1 CCIFG - UART RX TACCR1 += UART_TBIT; // Add Offset to CCRx if (TACCTL1 & CAP) { // Capture mode = start bit edge TACCTL1 &= ~CAP; // Switch capture to compare mode TACCR1 += UART_TBIT_DIV_2; // Point CCRx to middle of D0 } else { rxData >>= 1; if (TACCTL1 & SCCI) { // Get bit waiting in receive latch rxData |= 0x80; } rxBitCnt--; if (rxBitCnt == 0) { // All bits RXed? rxBuffer = rxData; // Store in global variable rxBitCnt = 8; // Re-load bit counter TACCTL1 |= CAP; // Switch compare to capture mode __bic_SR_register_on_exit(LPM0_bits); // Clear LPM0 bits from 0(SR) } } break; } } //------------------------------------------------------------------------------
     
    You can compare my code with the standard TI Demo code and see what i have done to open PINs when specific characters are sent thru a Terminal Program
     
    I have attached u a Terminal programm. U will use that to communicate with your launchpad. You will have to select the COMM port on witch your launchpad is (check windows device manager for MSP430 UART COMM port). In the termianl program you have to select the proper baudrate.
     
    P.S I am using the msp430g2452 on my Launchpad. So you will have to change the "#include "msp430g2452.h" with something proper to your device.
    Terminal.rar

  25. Like
    larsie got a reaction from YanuarPrijadi in Wrist watch project   
    I've now got the first batch of the 250 SPI B/W small LCD displays that I ordered, but I'm not quite sure what to do with them. The obvious thought is a booster pack, but since this is quite a small display I'm thinking maybe I could make a watch kit with it. I might also make some booster packs eventually.
     
    The display data sheet is here. It is SPI-based, but it uses a 9-bit SPI interface. The first bit is decides whether it's a write to the display memory or a config-command. As far as I understand, the USCI-chips don't support 9 bits, while the USI ones do. I've made a bitbanging driver for it so far, and it works ok. I guess with an HW-driver it'll be updating faster. I'll see if maybe it can be tweaked onto the USCI peripheral by sending 2 bytes.
     
    The features are:
     
    - small (34 x 30 mm physical size. Viewing area 28x19)
    - 3-line SPI 9-bit (Driver Sitronix ST7579-G2)
    - low power
    - backlight
    - black and white LCD
    - approx 3 USD cost
     
    I made a watch with the earlier LCD display (i2c-version) I was using. Here's a picture. The SPI-display is slightly smaller, but the display quality is similar (slightly better on the SPI display). I will have 250 of these, so if anyone is interested in this display for projects, let me know. I'm planning on making some packs that are finished soldered and can be sold in the shop, but it's relatively easy to solder these displays onto a board for your own projects also.
     

     
    So I'm planning on making a watch-board for the new display. It'll have the display soldered onto one side. The other side will have space for example for a MSP430G2452. The design will be open source. Any suggestions to peripherals and buttons? I could put an accelerometer there, for example to detect taps on the display. I guess I could also put a radio in it???
     
    Edit: Have changed the picture file to a newer version.
     

     

×
×
  • Create New...