View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 27, 2010 3:51 pm |
|
|
I don't have Proteus. I don't know very much about it. |
|
|
matheuslps
Joined: 29 Sep 2010 Posts: 73 Location: Brazil
|
|
Posted: Wed Oct 27, 2010 6:42 pm |
|
|
Sure you can simulate with Proteus.
Most of the codes works fine.
bye |
|
|
alex_ccs
Joined: 27 Oct 2010 Posts: 3
|
|
Posted: Thu Oct 28, 2010 9:43 am |
|
|
Thanks both.
I have simulate on Proteus but nothing happen. |
|
|
matheuslps
Joined: 29 Sep 2010 Posts: 73 Location: Brazil
|
|
Posted: Thu Oct 28, 2010 12:43 pm |
|
|
Please post your circuit and your code.
I will simulate it for you.
EDIT:
Done:
Circuit:
http://img7.imageshack.us/img7/6990/adclcd.png
Code:
Code: | #include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES BROWNOUT //Reset when brownout detected
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#use delay(clock=4000000)
#include <LCD.C>
void main()
{
int8 q;
float p;
setup_ccp1(CCP_PWM);
setup_timer_2(T2_DIV_BY_16, 255, 1);
setup_adc_ports(AN0); //Analogic channel 0
setup_adc(ADC_CLOCK_INTERNAL); //internal clock
lcd_init();
set_adc_channel(0); //enable channel 0
delay_us(20);
while (TRUE)
{
q = read_adc(); //read channel 0
p=0.392*q;
printf (lcd_putc, "\fADC = %4u \n%4.2f percent", q, p);
set_pwm1_duty(q);
delay_ms(100);
}
}
|
bye |
|
|
alex_ccs
Joined: 27 Oct 2010 Posts: 3
|
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
proteus .... |
Posted: Thu Jul 21, 2011 3:50 pm |
|
|
You can simulate quite a few pic situations with Proteus
But - after having it suggested to me
and trying it exactly ONCE - i will NEVER touch it again.
If you want to know how a program really works - you should make the effort to build the actual hardware and do it for REAL.
Proteus simulated pic code is NOT a basis for a working product that i would ever rely on.
For school class maybe -
but not in the world of designs that HAVE to work. |
|
|
|