Recent content by NorthGuy

  1. NorthGuy

    Serial Communication with dsPIC30F4011

    The oscillator is 7.37, not 7.5 MHz. So the baud should be 191 instead of 194. Not a big difference, but who knows, combined with the oscillator error of 2%, might be enough to screw up.
  2. NorthGuy

    MSP430 vs C2000 As a motor Controller

    http://www.microchip.com/wwwproducts/en/dsPIC33EP32MC202 The thing is designed to run motors. There's also a huge variety of similar products (bigger, smaller etc.)
  3. NorthGuy

    Reading PIC ports

    True. Bot might not be a good idea for someone who's starting with PIC.
  4. NorthGuy

    Reading PIC ports

    No. Regardless of the nibble you feed to it, it tests each of the 4 bits only once. This makes 4 tests. You can run it in the debugger and count the tests. If you think some of the branches take longer, please let me know what nibble should we feed to it to make more than 4 tests.
  5. NorthGuy

    Reading PIC ports

    I do know what I'm talking about. Just look at my code in post #5. I think it's clear enough to understand. There are 4 bits. My code tests each bit once. And that is enough to separate the execution into 16 branches, which are marked with "do here what you want for code such and such". Since...
  6. NorthGuy

    Reading PIC ports

    Why not? My code which I posted in post #5 does bit-test and works faster than the nibble-compares or even decrement and compare. Its execution time is from 9 to 13 cycles (not including return) - 10.5 average and 13 worst case. For comparison, the code you posted in post #7 takes 6 to 90 cycles...
  7. NorthGuy

    Reading PIC ports

    You could use a jump table, but if you want something easily understandable then do something of that sort. It's called "binary tree": ; assume the code is stored in the variable called "CODE" ; use: call ProcessCode ProcessCode: banksel CODE CASE_xxxx: btfsc CODE,3 goto CASE_1xxx...
  8. NorthGuy

    Modulating ADC channels?

    I usually do one small change at a time. Then, if something breaks, I know that this was my last change which caused this and nothing else. If you do three or four changes, then it's getting hard to guess which change caused the problem. So, I would go back to the connection and program which...
  9. NorthGuy

    Modulating ADC channels?

    In your past code, it worked with AN1 (GP1). This code uses AN2 (GP2) and AN3 (GP4, the one you're blinking). Have you moved your connections?
  10. NorthGuy

    Modulating ADC channels?

    If you want GP5 to turn on when both channels are present you need: if ((temp_peak >= 80)&&(temp_peak1 >= 80)) // both are on ... if ((temp_peak <= 60)||(temp_peak1 <= 60)) // at least one is off If you want GP5 to turn on when either of the two channels is present you need: if ((temp_peak...
  11. NorthGuy

    Design Simple microcontroller circuit

    Do you really want to battle these OSCCAL (and other) problems with 10-year old chips? Why not to try PIC12F1501?
  12. NorthGuy

    Help with ADC conversion registers in PIC or possible logic in code flaw

    You probably need to move the ADC acquisition code (marked "Start ADC conversion process") inside the "while (count < 64)" loop. The 2 and 3 second delays (when you turn GP5 on or off) stop the whole processes, so GP4 stops blinking while these delays are performed. If you want it to blink...
  13. NorthGuy

    Help with ADC conversion registers in PIC or possible logic in code flaw

    Exactly, therefore the temp_peak is not working very well when you update it continuously. Another measure, such as exponential average, which doesn't require re-setting would work better. For example, you could read a value and calculate x = abs(v-512)*a + x*(1-a). "a" is between 0 and 1 here...
  14. NorthGuy

    Help with ADC conversion registers in PIC or possible logic in code flaw

    If you get your temp_peak between 70 and 144 at any point after count > 120 and the load is off, then temp_peak will neither decrease (because min and max won't reset) nor increase (because there's no power). Thus, none of your "if" statements involving temp_peak will be called. If you want to...
  15. NorthGuy

    How to program SPI board

    Step 1. Get the datasheet for your board. Read it. Understand it.
Top