Jump to content

scud21

EstablishedMember
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About scud21

  • Rank
    Regular
  1. I need software reset too..hey this one really works! Thanks!
  2. hi i have a main.c and two header files (initialization.h and function.h). the summary is i integrate all my modules and turn them into function/process so that my main.c program will just call them. my function/process use timers. heres the problem: when i put the "void interrupt(void)" process in the function.h it compiles successfully but it doesn't work. but when i put "void interrupt(void)" process in the main.c it compiles error, saying here are my sample code: main.c #include <function.h> //Target PIC16F877 configuration word #pragma DATA _CONFIG, _PWRTE_OFF
  3. just a reminder: microcontrollers will not accept negative AC voltages (they might get damage --> based from my experience). try to use level shifter or a clipper. And another thing, put bypass capacitors in your PIC's regulator. here is a helpful link:
  4. XT = Temperature Compensated Crystal !CP = No comparators !WDT = No Watchdog Timer !PWRT = ... No Power on reset? BODEN = BrownOut Detect LPV = Low Voltage Programming !CPD = No clear power down detect ? WRT = Write Protect !DEBUGGER = No Debugger adon enables/disables AD in the adcon register No, your pragma line did not affect the adcon register, and yes you need to disable AD if you want to use it as a regular IO port. <{POST_SNAPBACK}> i think: !CP = disable Code Protect XT = use crystal oscillator instead of RC, internal osc, etc **for the rest look a
  5. what is the limit size of the hex file that i can load to my microcontroller? let say, for pic16f877a?
  6. i have simulated adc in pic16f877a in sourceboost ide and there were no problems or what so ever...
  7. why not try to use an interrupt routine in your function? when an interrupt occurred, have your conditional statements handle where you want to go in your main.
  8. look at the datasheet and in the internet about timer (timer0, timer1, etc.). i know they are also used to generate PWM in PIC's
  9. i forgot, the counter and realtime variables are both global
  10. well i can't give you my exact code in my heart module but here is a simple algorithm that i develop. void interrupt(){ if(tmr0 interrupt occured) { counter++; if(counter==49){ //already 0.05 second realtime++; counter = 0; } clear interrupts of timer0; } } void main() { /* put the initializing stuff here for ADC and timer0 */ while(1){ ADC() //do the ADC here /* do the parameter comparison here */ if(if the signal digitized is null) goto ADC again; if(first pulse is detected){ start timer0; goto ADC again; } if(second pulse is detected){ end timer0; } }
  11. if you,ve measured the time, you can derived the frequency from it. In my module that measure heart rate, i used timer0 of PIC16f877a. what is your target microcontroller anyway?
  12. thanks for replying asmallri. i figured out what was wrong. it's not in sourceboost boostc but in my bread board. its loosen in the back. damn that breadboard..hahahah please disregard this stupid post of mine.
  13. hi my code works in simulation but in the real world it doesn't. my target PIC is PIC16f877a, 4Mhz Xtal Oscillator. before going specific here is my code: #include <system.h> #include <boostc.h> //Target PIC16F877 configuration word #pragma DATA _CONFIG, _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_ON & _CPD_OFF & _DEBUG_OFF & _XT_OSC & _CP_OFF //Set clock frequency #pragma CLOCK_FREQ 4000000 unsigned short R_peak1 = 0x0265; unsigned short R_peak2 = 0x01ea; bit flagR1 = 0; bit flagR2 = 0; unsigned int RRcounter = 0; unsigned short Nullplus = 0x
×
×
  • Create New...