Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About jwilson

  • Rank
  • Birthday 02/20/1980

Profile Information

  • Gender
  • Location
    Arkansas, USA
  1. Thanks for the clarification. I didn't even think about how the pushbutton would call the interrupt twice. I do not have to go to sleep, the second version I posted works great and is less code. I just wanted to know what I was doing wrong and why it wouldn't work. In the past I have always implemented an interrupt using the timer. On the final version of this project I also plan to use a timer. The main reason for my questions were to learn about what I was doing wrong and how to solve them in case it ever presents itself again. Again thanks for the help, you cleared it up fo
  2. I just tried only disabling the RAIF bit and it works also. I can only assume that bringing the GIE = 0 affects the delay_s function. I really would like conformation that I am not insane though. Haha
  3. Reynard, that didn't fix it either. But I did find something that did. Maybe you can shed some light as to exactly why. Simply removing the interrupt disable command solved my problem. Does making GIE=0 effect the delay_s routine? //intcon &= 0x7F; //disable interrupts
  4. I tried this with no changes. If it will help to point out the problem... the following code works. It accomplishes the same goal but I wanted to use sleep mode and have to find out what in the world is keeping the original code from working correctly. //----------------INITIATE------------------- void initiate(void) { option_reg = 0x00; // bit 7=0 enable pullups // bit 6=0 don't care // bit 5=0 Fosc/4 = tmr0 clock // bit 4=0 don't care // bit 3=0 prescaler assigned to tmr0 // bits 2-0=000 prescale = 1:2 (won't use) cm1con0 &= 0x7F; //turn comparator cm2con0 &=
  5. Hey guys I am working on an extremely simple project, but I am beating my head trying to get it to work the way I want. If you look down you will see that I call the delay_s function two times. I did this because on the final version of the software I will have to delay for a few minutes, therefore I will go over the 255 maximum for the delay functions (unless this has changed). What is happening is that my delay is twice what it should be. I have commented out the second delay function call and still with a single function call I am getting twice the time. I am sure there is something
  6. I didn't even think about if no digits were there. My way would give me an endless loop, and that is not good. I am still a little wet behind the ears at coding, I really appreciate the help you have given me. Thanks yet again.
  7. Does this look okay? The array rx_buffer is global. unsigned int weight() { char *weight_ptr; unsigned int weight_int; unsigned char digit_flag; unsigned char j; for(j=0; digit_flag != 0; j++)//find where digits start { digit_flag = isdigit(rx_buffer[j]); } weight_int = strtoi(&rx_buffer[j], &weight_ptr, 10);//convert string to int return weight_int;
  8. In your example lets say the string was "ABCD1234" instead. Would you set *myBuf to point at mybuffer[4] instead of starting at the front of the array?
  9. I am receiving ASCII characters in my UART and storing them into a character array. I need to take 3 or 4 of those chars in the array and evaluate them. They will be one number (e.g. 139). I know how I can do this a sloppy way, just taking each char, converting to decimal, etc. What I wanted to know was if there was a built in function that would basically do this for me? I found this function in the manual, but was a little unclear on how it worked. Can anyone give me a little more information on it and its uses?
  10. Guys someone local needs to come give me a swift kick in the you know what. I started thinking.... If my micro can communicate with my PC just fine and the scale can communicate with the PC just fine, what is the deal. Then it hit me. The TX and RX wires are backwards when I connect my micro to the scale. I just didn't catch it before. So I switched that and everything worked beautifully the way it should regardless of the oscillator. Thanks for all of the help guys, I learned a lot.
  11. Currently I am using the STX command as a qualifier, then placing the data into my array after that. I really don't think that part is my issue now, but I will note that and try it if the crystal doesn't provide any improvements. Thank you for your suggestions.
  12. The load cell is already connected and the entire system has been calibrated. The display that you see above is with my weight on it (182.8 lbs), it follows the data stream perfectly. When I add more weight or less weight the value changes exactly like it is supposed to.
  13. Raghunathan, Below is the setup for the serial port on the weight indicator. Some of this won't pertain to the protocol at all. EDP = 9600/8NONE/CR/OFF Print (not used though) = 9600/8NONE/CR STREAM = EDP STMDLY = 1SEC PRNDES = EDP PROTCT = DISABLE
  • Create New...