Micmar 0 Posted March 23, 2012 Report Share Posted March 23, 2012 hello I have wrote a little program to test the comparator and change two output Report: of simulation PA2 work well PA5 not work comparator not work in attachement the program. PS in tha "basic" ide I am unable to work with the autocompletion Thanks in advance for your attenction. Best regards, Marco t1.zip Quote Link to post Share on other sites
Dave 0 Posted March 28, 2012 Report Share Posted March 28, 2012 Micmar, I have wrote a little program to test the comparator and change two output Report: of simulation PA2 work well PA5 not work Still looking into this one, it's not straight forward. Regards Dave Quote Link to post Share on other sites
Ettore 0 Posted April 6, 2012 Report Share Posted April 6, 2012 I have found in your code a number of small problems. I'm not sure whether these do affect on the simulator but certainly they do on the real hardware. 1) The following pragma line is wrong: 'System Config2 W_PROT_OFF, PLLX4_DISABLE,STAK_OVF_RESET #pragma DATA _CONFIG2, _WRT_OFF & _PLLEN_OFF, _STVREN_ON You should remove the comma before _STVREN_ON and replace it with & (ampersand). In different words it becomes: 'System Config2 W_PROT_OFF, PLLX4_DISABLE,STAK_OVF_RESET #pragma DATA _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON 2) Enabling the global and peripheral interrupts is needed but not enough. The Comparator interrupt must be enabled in order to make your code to work as expected. You need to add somewhere in your code the line - after the line set_bit(intcon,GIE) is a good place - : set_bit(pie2, C1IE) 'enable comparator C1 3) In your code the line #pragma CLOCK_FREQ 1000000 makes me thinking you want 1MHz for the internal oscillator to setup. If that's the case then you should add the line at the very first instruction of your code: osccon = 0x58 ' set oscillator register control to 1MHz Please note that the internal oscillator frequency is set to 500KHz by default if you don't change osccon. The #pragma CLOCK_FREQ is only used to generate the correct delays in the delay instructions. Quote Link to post Share on other sites
Micmar 0 Posted April 7, 2012 Author Report Share Posted April 7, 2012 Hello Ettore Thanks for your help. This time I did more tests, and placed the errors you have reported to me, this ide is totally new for me, but I continue to have problems. In the simulation PA4 output remains set also writing trisa4 = 1 and port 5 does not change status. The PA3 that is only an input is always seen output. But the strangest thing is that I can not do the flashing LED on the board, while in simulation works, but doing the program with the old basic compiler that I want to replace, because it has no built-in simulator, the LED flashes. I'm pretty disappointed in this. Happy Easter and thanks again, Marco Quote Link to post Share on other sites
Dave 0 Posted April 7, 2012 Report Share Posted April 7, 2012 Micmar, Micmar, I have wrote a little program to test the comparator and change two output Report: of simulation PA2 work well PA5 not work Still looking into this one, it's not straight forward. The problems here are two:1) Error in the PIC16 Ext simulator that does not allow connection to the correct pin. 2) Errors in .TDF that list the names associated with each pin. These will be fixed in the next release, Regards Dave Quote Link to post Share on other sites
Micmar 0 Posted July 23, 2012 Author Report Share Posted July 23, 2012 Hello I have tested the simulator with the 7.10 release but it fail again :( Can youn fix this? I work strong with this family Thanks and Regards, Marco Quote Link to post Share on other sites
Dave 0 Posted July 24, 2012 Report Share Posted July 24, 2012 Micmar, Hello I have tested the simulator with the 7.10 release but it fail again :( Can youn fix this? I work strong with this family What exactly is not working?I ran the program you posted at the beginning of this thread and it seemed to work - well PA5 is working. Does this work for you? Regards Dave Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.