A few things to fix. Your "sensor" variable should be dimensioned.
example from 'gcbasic help' - dim DataList(10)
You set up an interrupt. I am not sure what is hooked to it but if the pin is floating then power lines will trigger it at 60 hz. Do you need the interrupt?
Remember to keep an interrupt short. Both of the serial routines are long.
When you switch analog inputs , you must wait a little for the selection to stabilize. Check out section 9.2 and 9.3 in manual .
GL
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the external INT pin is hooked to the serial tx so receives from the pc, is low when idle, and interrupts when high, there is a pull down resistor in place to keep false interrupts. the program only crashes when readAD is in place, otherwise it runs just fine, and when i have just readAD and have the interrupt removed it also runs fine. the problem comes when i have both in place, itll crash randomly. ill have to give a small wait time in my main loop a try and see if that helps. my other option is using my other pic chip which has a hardware usart, but id like to use the 16f616 because its always soldered into place.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
when i compile this and try to trace the interrupt in the compiled.lst file, it looks like four "calls" is as deep as it goes. I am not an expert but i am thinking about the depth of the stack being only 8. how much stack does each call use? 1 or 2 bytes?
Usually you want the interrupt to be short in amount of work to be done. Set flags and do the work outside of the interrupt. that is what i would try next.
You say each part works by itself which is good troubleshooting(divide and conquer).
gl
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i never really understood how the stack worked, other than each sub used stack space (but i dont know how much space each sub uses in the stack, but i do know that some functions such as the software serial routines use additional stack). i just went a different direction and changed my chip to one with a hardware uart. so far im not having the same problems. thanks for the advice
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
when i use readAD and SerReceive together it causes my pic to crash randomly. this code, crashes on my pic and i dont know what the problem is
A few things to fix. Your "sensor" variable should be dimensioned.
example from 'gcbasic help' - dim DataList(10)
You set up an interrupt. I am not sure what is hooked to it but if the pin is floating then power lines will trigger it at 60 hz. Do you need the interrupt?
Remember to keep an interrupt short. Both of the serial routines are long.
When you switch analog inputs , you must wait a little for the selection to stabilize. Check out section 9.2 and 9.3 in manual .
GL
the external INT pin is hooked to the serial tx so receives from the pc, is low when idle, and interrupts when high, there is a pull down resistor in place to keep false interrupts. the program only crashes when readAD is in place, otherwise it runs just fine, and when i have just readAD and have the interrupt removed it also runs fine. the problem comes when i have both in place, itll crash randomly. ill have to give a small wait time in my main loop a try and see if that helps. my other option is using my other pic chip which has a hardware usart, but id like to use the 16f616 because its always soldered into place.
when i compile this and try to trace the interrupt in the compiled.lst file, it looks like four "calls" is as deep as it goes. I am not an expert but i am thinking about the depth of the stack being only 8. how much stack does each call use? 1 or 2 bytes?
Usually you want the interrupt to be short in amount of work to be done. Set flags and do the work outside of the interrupt. that is what i would try next.
You say each part works by itself which is good troubleshooting(divide and conquer).
gl
i never really understood how the stack worked, other than each sub used stack space (but i dont know how much space each sub uses in the stack, but i do know that some functions such as the software serial routines use additional stack). i just went a different direction and changed my chip to one with a hardware uart. so far im not having the same problems. thanks for the advice