Jump to content
43oh

tingo

Members
  • Content Count

    158
  • Joined

  • Last visited

Reputation Activity

  1. Like
    tingo reacted to zeke in What is "our" time worth ?   
    To me, everything is for sale but if the client doesn't own it until he purchases it.  In other words, the software IP remains the property of the one who wrote it until such time as he sells it. 
     
    You ought to make this a condition in your contract agreement i.e.: "The ownership of the software remains in the possession of yyrkoon and shall not be copied, eaten, sold, resold, sacrificed or mimicked in any way for ever and ever and ever, Amen. But if you buy it for the low low price of $1 million dollars then you can blend it to your hearts content."
     
    Don't let anyone make assumptions. Spell it out in excruciating detail so everyone knows what is expected of them.
  2. Like
    tingo reacted to zeke in What is "our" time worth ?   
    @@yyrkoon
     
    The price all depends upon the situation. If the person gives me the vibe that they are a risk of not paying then the price is high.
     
    I want them to know that I am a Professional Engineer.
     
    I've been burned in the past by someone who contacted me via this website. I was not paid for 12 hours of my time. I have chosen to never let that happen again. 
     
    For my own reasons, I have not revealed that person's identity to the rest of this community because I believe that they are not a regular here. They know how much of a flake they are. They don't need me to shout it from this rooftop. 
     
    I honestly hope they never come back to this website ever again. 
    ?_? 
     
     
     
    On the topic of the price, here are my thoughts. I have an initial one hour phone conversation with the person and make an initial assessment of the scope of work. I figure out these things:
    Do I have all the resources needed to solve this person's problem? Do I have the skills to solve this person's problem? Do I have the time to solve this person's problem? Does the person have the time to wait for my solution? Does this person have the authority to solve this problem for him? Does this person have the money to pay for my solution? What does the solution look like? Where can compromises be made in the solution? Can logical milestones be found for the work deliverables? Essentially, what are the risks and rewards for both parties in this work effort?
     
    If the time required to complete the project is long then I can afford to lower the hourly rate. If the time is short to complete then I usually increase the price somewhat.
     
    Depending upon the relationship that develops between both parties, the payment style can be established i.e.: Lump Sum vs Hourly vs Value Based.
     
    If is my opinion that the best example of Value Based pricing is where I create a solution for a client then sell that client many units. In that case, I retain the ownership of the IP.
     
    In the case of Lump Sum or Hourly pricing, it is my belief that the customer has a right to ask for ownership of the IP. That IP must be paid for though. There is a lot of wiggle room in this instance i.e.: How much of the IP and how much you charge for it is up for discussion. You have control over what is on the negotiating table.
     
     
    The Project Assessment Agreement is my way of initially building trust between two trustworthy parties. It's my way of saying "This is what I am thinking. If you are thinking the same thing then we can do business together. If not then please go away in peace."
     
    After the PAA has been completed, a formal contract must be written before the work on the complete project can commence. 
     
    The formal contract will spell everything out in gloriously, painful detail so that both parties are keenly aware of the expectations they have agreed to meet.
     
    Does that answer the question?
     
    By the way, this is a good discussion. I like it.
       
     
  3. Like
    tingo reacted to zeke in What is "our" time worth ?   
    @@yyrkoon
     
    I've been self employed since 2005. I could tell you my stories.
     
    For me, the answer to this question is the most important: What do I want?  My answers typically cover the range from selfish to selfless.
     
    The latest craze amongst the self-employed is value based pricing. It's a tricky thing to pull off if you haven't got lots of experience writing proposals and contracts. I haven't done it myself. I usually just charge a high fee.
     
    Here's a copy-paste of my Project Assessment Agreement that I give to all new prospective clients. This is my tool to figure out if the work is worth the effort required.
     
    =======
    Project Assessment Agreement
    The purpose of the project assessment agreement is to equally establish expectations of both you (the client) and Nine Micron Inc.
     
    Minimum deposit is $1000 which covers the first four hours payable in advance.
     
    Work will continue to a maximum of eight hours which caps the assessment fee at $2000.
     
    If the assessment takes the full eight hours then the fee is due upon delivery of the report.
     
    Work proceeds when all necessary information is provided or otherwise obtained.
     
    The assessment phase will result in:
    A summary of the problems at hand, A description of all possible solutions and, An assessment of the risks and rewards of each possible solution. Process Flow Steps:
    Define the objective. List out all possible successful solutions. Decide which solution to use. Explain why that choice is the best one. Test the solution and collect data to prove that the solution is in fact successful. =========
     
    Another benefit of this tool is to weed out the people who will not value your services. It works well to reduce your initial risk and establishes that you are in control on the work effort.
     
     
    Feel free to copy, edit, modify and use it too suit your needs.
     
    I hope it helps even a little bit.
     
     
     
  4. Like
    tingo reacted to Rickta59 in Flow Chart Template   
    We are all dating ourselves by responding to this post : )...
     
    This is the one I remember:

     
    I also have a metal ruler that was used for laying out formats for an IBM line printer.
     
    -rick
  5. Like
    tingo got a reaction from spirilis in TI-EStore New Year   
    Well anyway, I got the package in my hands now. My first thought was that it was very quick this time ("I just only ordered two days ago"). My second thought was that FedEx has at least learned, because I got a text message before any delivery attempts today (so I rerouted it to my work address). Then I checked the tracking and found out FedEx tried to deliver it to my home yesterday. So FedEx is still doing as bad as ever here when it comes to residential delivery. Well, at least TI was quick to ship, and four days from US to here isn't bad.
  6. Like
    tingo got a reaction from yyrkoon in Act of god chip decapping.   
    Revelation: you managed fine for (about) a week without internet.
  7. Like
    tingo got a reaction from calinp in Nokia 5110 display   
    Very nice - thanks for informing us.
  8. Like
    tingo got a reaction from tripwire in Gotek floppy emulator uses STM32   
    Based on the Cortex Amiga Floppy Emulator article, it seems like this device uses a STM32 chip. Fun times ahead!.
    And here is a review of a Gotek "1000 floppies" version: http://goughlui.com/?p=3246
  9. Like
    tingo got a reaction from bluehash in Gotek floppy emulator uses STM32   
    Update: Jeff, of HxC floppy emulator fame, has created a bootloader for Gotek drives, and released a version of HxC firmware for them too: http://hxc2001.com/download/floppy_drive_emulator/index.html#stm32hxc
    Ok, it is still in beta, but interesting anyway.
  10. Like
    tingo got a reaction from jpnorair in I want to buy an awesome 3D Printer   
    I don't define a consumer price range because it is difficult. It depends on too many factors. But see my next point, maybe that will help.
    I don't give an example of an awesome printer simply because I have not seen one yet.
    I have seen videos of professional 3D printers, some of them might be awesome, but they cost a lot (typically USD 15000.- and up), and it is hard to judge the awesomeness of a 3D printer from a few minutes of demo video.
  11. Like
    tingo got a reaction from Lgbeno in analog.io   
    This is a very cool thing!
  12. Like
    tingo got a reaction from bluehash in Arduino vs Arduino   
    Aha! So this is how Intel is planning to get rid of those annoying Arduinos! By making the community fight and split up themselves. </conspiracy theory mode>
  13. Like
    tingo got a reaction from spirilis in Arduino vs Arduino   
    Aha! So this is how Intel is planning to get rid of those annoying Arduinos! By making the community fight and split up themselves. </conspiracy theory mode>
  14. Like
    tingo reacted to bluehash in 43oh Welcomes Stellarisiti, BeagleFu and C2000 Members   
    Hello All,
    Welcome to 43oh!
    If you are unsure, what this is about, please read the "http://43oh.com/2015/03/one-community-to-discuss-them-all-stellarisiti-c2k-and-bfu-merging-with-43oh/'>One Community To Discuss Them All
  15. Like
    tingo reacted to rebeltaz in just wanted to show off my latest clock :)   
    Ok... so compared to some of the projects I see on here, I feel like amateur hour at the Apollo, but.... Here goes:
     
    I love building clocks, but I have no use for time itself. So a long time ago, I thought of doing this project. It wasn't until I fell in love with the MSP430 that I dusted it off and got to it. I call this piece "Beyond Time & Space."  It is 12"x24" and every bit is custom built and hand painted.
     
    I would love to be able to post this to Etsy or something and sell a few, but with what I have in this, both in materials and time, I'd have to charge close to $600 for it and I doubt anyone would be willing to pay that
     
    I need to get better pictures of the actual finished product, but I enjoy it and I hope you guys do, too!
     

  16. Like
    tingo got a reaction from rebeltaz in just wanted to show off my latest clock :)   
    Nicely executed - I love to see beautiful projects like this.
  17. Like
    tingo got a reaction from tripwire in First actual fried MSP430   
    Back in the days I worked for a electronics repair unit for the Army in my country.
    My "fireworks" memory: Two colleagues got to fix the "battery conditioner", a purpose built charge / discharge and measurement unit for all kinds of rechargeable batteries. This was a large rack-mounted unit, with 15 -20 or so "outputs" to connect batteries to. The control logic was all TTL, on many cards (probably Eurocard-sized). While doing fault-finding, they had the control unit partly disassembled on the workbench. They also had a few batteries there (probably to load the outputs). For some reason, they had the battery voltage from one battery on a test lead with a measuring probe on the end, this voltage was +55V dc... when one of them lost the probe, it dropped onto the +5V on one of the boards... there was a few seconds of fireworks, the there was black plastic bits (tops from TTL chips) all around several meters away, some of them burning.
     
    To avoid putting all the blame on someone else, my "finest moment" in those days was this: we had just received a new instrument from one of our suppliers, a fancy (and expensive) oscilloscope, logic analyzer or something. Me and a colleague was unpacking it, we couldn't get it out of the box fast enough, we wanted to plug it in and start playing with it. When it was out of the box and on the workbench, I grabbed the power cable, noticed it had the wrong plug (a UK plug), and simply grabbed another power cable, and plugged it in, without thinking about checking the 120 VAC / 230 VAC switch that all instruments had in these days. Naturally, the instrument lasted only two seconds after being turned on. The only thing to do was to pack it into the box again and return it to the supplier. (Of course the supplier should have changed this switch before sending us the instrument, but finding a power cable with a UK plug in the box should have warned me).
  18. Like
    tingo reacted to rampadc in F550x Breakout Boards   
    Here you go: http://flashandrc.wordpress.com/2014/06/07/thinkpad-keyboard-project-its-over/ and http://www.instructables.com/id/A-Better-ThinkPad-USB-Keyboard-Adapter/?ALLSTEPS.
     
    And RobG helped me with the caps questions so no worries. 
  19. Like
    tingo got a reaction from bluehash in Gotek floppy emulator uses STM32   
    Based on the Cortex Amiga Floppy Emulator article, it seems like this device uses a STM32 chip. Fun times ahead!.
    And here is a review of a Gotek "1000 floppies" version: http://goughlui.com/?p=3246
  20. Like
    tingo got a reaction from bluehash in How do you like this forum platform?   
    It works ok. Nothing to complain about. :-)
  21. Like
    tingo got a reaction from ILAMtitan in First actual fried MSP430   
    Back in the days I worked for a electronics repair unit for the Army in my country.
    My "fireworks" memory: Two colleagues got to fix the "battery conditioner", a purpose built charge / discharge and measurement unit for all kinds of rechargeable batteries. This was a large rack-mounted unit, with 15 -20 or so "outputs" to connect batteries to. The control logic was all TTL, on many cards (probably Eurocard-sized). While doing fault-finding, they had the control unit partly disassembled on the workbench. They also had a few batteries there (probably to load the outputs). For some reason, they had the battery voltage from one battery on a test lead with a measuring probe on the end, this voltage was +55V dc... when one of them lost the probe, it dropped onto the +5V on one of the boards... there was a few seconds of fireworks, the there was black plastic bits (tops from TTL chips) all around several meters away, some of them burning.
     
    To avoid putting all the blame on someone else, my "finest moment" in those days was this: we had just received a new instrument from one of our suppliers, a fancy (and expensive) oscilloscope, logic analyzer or something. Me and a colleague was unpacking it, we couldn't get it out of the box fast enough, we wanted to plug it in and start playing with it. When it was out of the box and on the workbench, I grabbed the power cable, noticed it had the wrong plug (a UK plug), and simply grabbed another power cable, and plugged it in, without thinking about checking the 120 VAC / 230 VAC switch that all instruments had in these days. Naturally, the instrument lasted only two seconds after being turned on. The only thing to do was to pack it into the box again and return it to the supplier. (Of course the supplier should have changed this switch before sending us the instrument, but finding a power cable with a UK plug in the box should have warned me).
  22. Like
    tingo reacted to Fred in Animated Darth Vader build monitor   
    At work we use Continuous Integration to build and test our code as we check it in. It helps catch problems early and ensures we keep code standards up. We were using CruiseControl.NET but have now moved to TeamCity. Anyway, this is no use unless people take notice of broken builds and this was starting to slip. I decided that something fairly visible (but not too annoying) was needed. After spotting a Lego Dath Vader toy torch it seemed like a good solution.
     
    The standard toy has a button on his chest that is used to switch on some while LEDs in his feet. There was also a red LED and a AAA battery in his lightsaber so it could be switched on. The plan was to add a servo to his arm so he could wave the lightsaber around and replace the red LED with a RGB one so that the colours could change. All of this under PC control of course.
     
    Rather than describe in in boring detail exactly what I did, I hope some photos of the progress will sum it up. First I had to get a servo in place operating his right arm. It required cutting away the battery compartment, filing the joint to make it a little easier to move and hot-gluing the servo in place.
     
     
     
    The front just involved making a bit more room to glue the servo in. The a slot needed to be carefully added for the servo horn to drive the arm. The horn was later screwed to the servo. The connection between the servo horn and teh shoulder joint is just a push fit.
     
     
     
    For the lightsaber, the battery, connectors, original PCB and LED had to be removed. The switch was glued in place as it wasn't to be used but needed to fill the hole. As ther was no PCB to locate the new LED, it was glued into place. Running the 4 wires from the RGB LED involved carefully drilling a path through the side of the lightsaber, the hand, arm and shoulder joint. I had to be careful that the wires coming out of the shoulder didn't limit the servo movement.
     
     
      
     
     
    The next step was putting all this under PC control. I decided that the recently release MSP430F5529 Launchpad would make be ideal due to the built-in USB functionality. It could easily handle a few PWM channels. All that was required was to connect ground, 5V and a PWM signal to the servo and 3 PWM signals to the channels of the LED. I wasn't going to drive the LED directly from the MSP430 pins, but to use a P channel MOSFET and a NPN transistor as a high side switch (for the common cathode LED). However it seems that the F5549 can handle a little more than the spec sheet says. I was lazy and just drive them via some 100 ohm resistors. The photo also shows the clear acrylic base (cut using a 40W CO2 laser cutter) and a 3D printed enclosure for the Launchpad.
     
     
     
     
    A small home etched PCB is underway so that it will just need a USB cable to his back rather than the bulky external Launchpad. Whether this phase 2 gets overtaken by other projects or not though - that's a good question.
     
    The connection between the device and the PC is using a USB serial port. The code is adapted from the sample CDC COM port code for the Launchpad. I used TA0.2 to TA0.4 for the LED PWM as these are easily accessible on the Launchpad. I used TA2.1 for the servo as this was conveniently close to the 5V supply needed for the servo.
     
     
    As far as what controls Darth Vader, I tried a number of options. Initial control was done from an ASP.NET MVC web page. Anyone in the office could control him with simple URLs like fredpc/Vader/Colour/Blue or fredpc/Vader/Position/0. The connection to TeamCity proved a little more difficult. I started work on a Java plug-in for TeamCity that woudl call these URLs, but it was a pain to get the plug-in installed and working in TeamCity. All the documentation I could find was out of date and incosistent - as is often the case with Java. I ended up going with a Windows service that polls TeamCity (using Rest APIs) every 10 minutes.
     
    I you'd like to see it working, here are a couple of videos of it in action.


     
     
    Well, I'm entering this is the Halloween contest - you can even see 43oh in the background in the second video. I hope it's Halloweeny enough, because strictly speaking it's a project that I did to use at work. It's in action right now monitoring our TeamCity build server. In fact the MD of the company wandered past my desk this afternoon to ask why Darth Vader was red. It's a bit scary being under that sort of pressure to fix any broken unit tests, but that was kind of the point...
     

    /* --COPYRIGHT--,BSD * Copyright (c) 2013, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * --/COPYRIGHT--*/ /* * ======== main.c ======== * Darth vader control: * * This code has been adapted from TI's cample CDC COM port code * ---------------------------------------------------------------------------*/ #include <string.h> #include "inc/hw_memmap.h" #include "gpio.h" #include "wdt_a.h" #include "ucs.h" #include "pmm.h" #include "sfr.h" #include "timer_a.h" #include "USB_config/descriptors.h" #include "USB_API/USB_Common/device.h" #include "USB_API/USB_Common/types.h" // Basic Type declarations #include "USB_API/USB_Common/usb.h" // USB-specific functions #include "USB_API/USB_CDC_API/UsbCdc.h" #include "USB_app/usbConstructs.h" /* * NOTE: Modify hal.h to select a specific evaluation board and customize for * your own board. */ #include "hal.h" // Function declarations BYTE retInString (char* string); // Global flags set by events volatile BYTE bCDCDataReceived_event = FALSE; // Indicates data has been rx'ed // without an open rx operation #define MAX_STR_LENGTH 64 char wholeString[MAX_STR_LENGTH] = ""; // Entire input str from last 'return' BYTE wildcardMatch (char* string, char* match); void send(const char* message); void initServo(void); void stopServo(void); void setServo(unsigned char duty); void parseAndSetServoPosition(char positionText); void setServoOffTimer(void); void initRgbLed(void); void setRgbLed(unsigned char red, unsigned char green, unsigned char blue); void parseAndSetColour(char* colourText); void vaderTest(void); unsigned char getHexDigit(char text); const unsigned int ServoPeriod = 655; // = 32768 / 50 = 20ms; const unsigned int positions[] = {30,34,38,42,46,50,54,58,62,66}; // 0.9 to 2.1ms /* * ======== main ======== */ VOID main (VOID) { WDT_A_hold(WDT_A_BASE); // Stop watchdog timer // Minumum Vcore setting required for the USB API is PMM_CORE_LEVEL_2 . PMM_setVCore(PMM_BASE, PMM_CORE_LEVEL_2); initPorts(); // Config GPIOS for low-power (output low) initClocks(8000000); // Config clocks. MCLK=SMCLK=FLL=8MHz; ACLK=REFO=32kHz USB_setup(TRUE, TRUE); // Init USB & events; if a host is present, connect initRgbLed(); initServo(); // Setup servo PWM __enable_interrupt(); // Enable interrupts globally while (1) { BYTE i; // Check the USB state and directly main loop accordingly switch (USB_connectionState()) { // This case is executed while your device is enumerated on the // USB host case ST_ENUM_ACTIVE: // Enter LPM0 (can't do LPM3 when active) __bis_SR_register(LPM0_bits + GIE); _NOP(); // Exit LPM on USB receive and perform a receive operation // If true, some data is in the buffer; begin receiving a cmd if (bCDCDataReceived_event){ // Holds the new addition to the string char pieceOfString[MAX_STR_LENGTH] = ""; // Holds the outgoing string char outString[MAX_STR_LENGTH] = ""; // Add bytes in USB buffer to the string cdcReceiveDataInBuffer((BYTE*)pieceOfString, MAX_STR_LENGTH, CDC0_INTFNUM); // Get the next piece of the string // Append new piece to the whole strcat(wholeString,pieceOfString); // Echo back the characters received cdcSendDataInBackground((BYTE*)pieceOfString, strlen(pieceOfString),CDC0_INTFNUM,0); // Has the user pressed return yet? if (retInString(wholeString)){ if (!(strcmp(wholeString, "TEST"))) { vaderTest(); } else if(wildcardMatch(wholeString,"POSITION ?")) { parseAndSetServoPosition(wholeString[9]); } else if(wildcardMatch(wholeString,"COLOUR #???")) { parseAndSetColour(wholeString+8); } else if(wildcardMatch(wholeString,"ALL ?#???")) { parseAndSetServoPosition(wholeString[4]); parseAndSetColour(wholeString+6); // Handle other } else { // Prepare the outgoing string strcpy(outString,"\r\nNo such command!\r\n\r\n"); // Send the response over USB cdcSendDataInBackground((BYTE*)outString, strlen(outString),CDC0_INTFNUM,0); } // Clear the string in preparation for the next one for (i = 0; i < MAX_STR_LENGTH; i++){ wholeString[i] = 0x00; } } bCDCDataReceived_event = FALSE; } break; // These cases are executed while your device is disconnected from // the host (meaning, not enumerated); enumerated but suspended // by the host, or connected to a powered hub without a USB host // present. case ST_PHYS_DISCONNECTED: case ST_ENUM_SUSPENDED: case ST_PHYS_CONNECTED_NOENUM_SUSP: //Turn off LED P1.0 GPIO_setOutputLowOnPin(LED_PORT, LED_PIN); __bis_SR_register(LPM3_bits + GIE); _NOP(); break; // The default is executed for the momentary state // ST_ENUM_IN_PROGRESS. Usually, this state only last a few // seconds. Be sure not to enter LPM3 in this state; USB // communication is taking place here, and therefore the mode must // be LPM0 or active-CPU. case ST_ENUM_IN_PROGRESS: default:; } } // while(1) } // main() /* * ======== UNMI_ISR ======== */ #pragma vector = UNMI_VECTOR __interrupt VOID UNMI_ISR (VOID) { switch (__even_in_range(SYSUNIV, SYSUNIV_BUSIFG)) { case SYSUNIV_NONE: __no_operation(); break; case SYSUNIV_NMIIFG: __no_operation(); break; case SYSUNIV_OFIFG: UCS_clearFaultFlag(UCS_BASE, UCS_XT2OFFG); UCS_clearFaultFlag(UCS_BASE, UCS_DCOFFG); SFR_clearInterrupt(SFR_BASE, SFR_OSCILLATOR_FAULT_INTERRUPT); break; case SYSUNIV_ACCVIFG: __no_operation(); break; case SYSUNIV_BUSIFG: // If the CPU accesses USB memory while the USB module is // suspended, a "bus error" can occur. This generates an NMI. If // USB is automatically disconnecting in your software, set a // breakpoint here and see if execution hits it. See the // Programmer's Guide for more information. SYSBERRIV = 0; //clear bus error flag USB_disable(); //Disable } } BYTE wildcardMatch (char* string, char* match) { char s; char m; BYTE i; for (i=0; i < MAX_STR_LENGTH; i++) { s = string[i]; m = match[i]; // No match if (s != m && m != '?') return(FALSE); // Reached the end if (s == 0 || m == 0) { // of both? return (s == m); } } // Catch any overrun return (FALSE); } /* * ======== retInString ======== */ // This function returns true if there's an 0x0D character in the string; and if // so, it trims the 0x0D and anything that had followed it. BYTE retInString (char* string) { BYTE retPos = 0,i,len; char tempStr[MAX_STR_LENGTH] = ""; strncpy(tempStr,string,strlen(string)); // Make a copy of the string len = strlen(tempStr); // Find 0x0D; if not found, retPos ends up at len while ((tempStr[retPos] != 0x0A) && (tempStr[retPos] != 0x0D) && (retPos++ < len)) ; // If 0x0D was actually found... if ((retPos < len) && (tempStr[retPos] == 0x0D)){ for (i = 0; i < MAX_STR_LENGTH; i++){ // Empty the buffer string[i] = 0x00; } //...trim the input string to just before 0x0D strncpy(string,tempStr,retPos); //...and tell the calling function that we did so return ( TRUE) ; // If 0x0D was actually found... } else if ((retPos < len) && (tempStr[retPos] == 0x0A)){ // Empty the buffer for (i = 0; i < MAX_STR_LENGTH; i++){ string[i] = 0x00; } //...trim the input string to just before 0x0D strncpy(string,tempStr,retPos); //...and tell the calling function that we did so return ( TRUE) ; } else if (tempStr[retPos] == 0x0D){ for (i = 0; i < MAX_STR_LENGTH; i++){ // Empty the buffer string[i] = 0x00; } // ...trim the input string to just before 0x0D strncpy(string,tempStr,retPos); // ...and tell the calling function that we did so return ( TRUE) ; } else if (retPos < len){ for (i = 0; i < MAX_STR_LENGTH; i++){ // Empty the buffer string[i] = 0x00; } //...trim the input string to just before 0x0D strncpy(string,tempStr,retPos); //...and tell the calling function that we did so return ( TRUE) ; } return ( FALSE) ; // Otherwise, it wasn't found } /* * Switch the servo off after it's settled to stop the hum */ void setServoOffTimer(void) { // Use Timer A1 for a one-shot interrupt TA1CCTL0 = CCIE; // CCR1 interrupt enabled TA1CCR0 = 32768; // About 1s TA1CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, up mode, clear TAR } // Timer0 A1 interrupt service routine #pragma vector=TIMER1_A0_VECTOR __interrupt void TIMER1_A0_ISR(void) { // Stop servo TA2CCR1 = 0; // Stop timer TA1CTL = TASSEL_0 + MC_1 + TACLR; } void parseAndSetServoPosition(char positionText) { if (positionText < '0' || positionText >'9') { stopServo(); send("\r\nArm servo off\r\n\r\n"); return; } setServo(positionText - '0'); send("\r\nArm servo position set\r\n\r\n"); } void initServo(void) { GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN4); TIMER_A_clearTimerInterruptFlag(TIMER_A2_BASE); //Generate PWM - Timer runs in Up-Down mode TIMER_A_generatePWM(TIMER_A2_BASE, TIMER_A_CLOCKSOURCE_ACLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, ServoPeriod, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_OUTPUTMODE_RESET_SET, 0); } void stopServo(void) { TA2CCR1 = 0; } void setServo(unsigned char position) { if (position > 9) { stopServo(); } else { TA2CCR1 = positions[position]; setServoOffTimer(); } } /* * Uses Timer A0 for 3PWM output * Chosen as these are accessible on LaunchPad * TA0.2 on P1.3 * TA0.3 on P1.4 * TA0.4 on P1.5 */ void initRgbLed(void) { P1DIR |= BIT3 + BIT4 + BIT5; // P1.3, P1.4 and P1.5 output P1SEL |= BIT3 + BIT4 + BIT5; // P1.3, P1.4 and P1.5 options select TA0CCR0 = 0xFE; // PWM Period TA0CCTL2 = OUTMOD_7; // CCR2 reset/set TA0CCR2 = 0; // CCR2 PWM duty cycle initially 0 TA0CCTL3 = OUTMOD_7; TA0CCR3 = 0; TA0CCTL4 = OUTMOD_7; TA0CCR4 = 0; TA0CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, up mode, clear TAR } void setRgbLed(unsigned char red, unsigned char green, unsigned char blue) { // Set PWM registers TA0CCR2 = red; TA0CCR3 = green; TA0CCR4 = blue; } void parseAndSetColour(char* colourText) { unsigned char red = getHexDigit(colourText[0]); unsigned char green = getHexDigit(colourText[1]); unsigned char blue = getHexDigit(colourText[2]); if (red == 255 || green == 255 || blue == 255) { send("\r\nUnrecognised colour"); return; } red *= 0x11; green *= 0x11; blue *= 0x11; // Set PWM registers setRgbLed(red, green, blue); send ("\r\nColour set\r\n"); } void vaderTest() { setServo(0); unsigned char x; // red for (x=0; x < 255; x++) { setRgbLed(x, 0, 0); __delay_cycles(50000); } setServo(1); // --> yellow for (x=0; x < 255; x++) { setRgbLed(255, x, 0); __delay_cycles(50000); } setServo(2); // --> green for (x=255; x; x--) { setRgbLed(x, 255, 0); __delay_cycles(50000); } setServo(3); // --> green/blue for (x=0; x < 255; x++) { setRgbLed(0, 255, x); __delay_cycles(50000); } setServo(4); // --> blue for (x=255; x; x--) { setRgbLed(0, x, 255); __delay_cycles(50000); } setServo(5); // --> purple for (x=0; x < 255; x++) { setRgbLed(x, 0, 255); __delay_cycles(50000); } setServo(6); // --> red for (x=255; x; x--) { setRgbLed(255, 0, x); __delay_cycles(50000); } setServo(7); // --> off for (x=255; x; x--) { setRgbLed(x, 0, 0); __delay_cycles(50000); } setServo(0); setRgbLed(0,0xFF,0); __delay_cycles(5000000); setServo(9); setRgbLed(0xFF,0,0); __delay_cycles(5000000); setServo(0); setRgbLed(0,0,0); } unsigned char getHexDigit(char text) { if ((text >= '0') && (text <= '9')) return (text-'0'); if ((text >= 'A') && (text <= 'F')) return (10 + text-'A'); if ((text >= 'a') && (text <= 'f')) return (10 + text-'a'); return 255; } void send(const char* message) { /* // Holds the outgoing string char out[MAX_STR_LENGTH] = ""; // Prepare the outgoing string strcpy(out, message); // Send the response over USB cdcSendDataInBackground((BYTE*)out, strlen(out),CDC0_INTFNUM,0); */ } //Released_Version_4_00_00  
  23. Like
    tingo reacted to piglet in My first ever electronics or micrcontroller project: Radio Word clock   
    I'm mostly a lurker on this forum, and watch in somewhat bemused awe at the things you folks manage to create. I'm right at the bottom of a massive learning curve with very little time to climb up it.
     
    Still, I'm very happy with my first ever electronics or microcontroller project. 
     
    It's a word clock inspired by an image of a commercial product I bumped into on the internet.
     
    Parts list:
     
    1) A cheap frame from our local hobby shop
     
    2) An http://www.pvelectronics.co.uk/index.php?main_page=product_info&products_id=2'>






  24. Like
    tingo reacted to Rickta59 in Is it just me or tonight TI doubled LaunchPad price?   
    OK, so I've been using the new msp430f5529 launchpad for a week or so. It seems like TI listened to our concerns. They have addressed most of the issues I have with the previous msp430 launchpad offering.
     
    o ) Serial issues , resolved, new version includes a small on board USB hub that provides a direct connection for the FET and one for the user USB. It runs faster than 9600 and doesn't seem to cause linux to hiccup.
     
    o ) Small ram and flash size. The msp430f5529 has 8k of ram and 128k of flash. In addition, the chip has been around for a while so you can order them from regular distro channels
     
    o ) Linux CCS full support. This LP has the ezFET device and it fully supports debugging using CCS with linux. Also, the open source tilib (libmsp430.so) works great with mspdebug and provides hardware debugging features only previously available with the "real" FET. Finally, the firmware can be upgraded so it can be used with newer chips that appear on the scene.
     
    So hats off to the TI crew, this launchpad seems worth the price they are asking !
     
    -rick
  25. Like
    tingo reacted to David Bender in Yet another DCO calibrator   
    This DCO calibrator starts with me not having a crystal on my board, and stealing rick's idea about using the UART to calibrate the DCO. It works without the UART peripheral or capture compare. The host sends the 'U' character and the micro responds with what adjustment it made, or that it calibrated to the target frequency. When the micro is calibrated, it sends the calibration constant values to the host, which prints them for the user. I used an oscope to verify the frequency on the P1.4's SMCLK output.
     
    Code is here:
    https://github.com/analog10/UART_DCO_Calibrator
     
    rick's original concept is here:
    https://github.com/RickKimball/msp430_code/blob/master/fabooh/examples/serial/dco_calibrate/goldilocks.cpp
×
×
  • Create New...