Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC Simulator

Status
Not open for further replies.
that one id not voltage
You can only use integer arithmetic, its easy to convert a voltage into an adc count by using a calculator
5V = 1023 adc value
the code above is an analog one

i want you to check it
I did check and I posted the corrected program

i cant test it to hardware
Why cant you test to hardware.???

what is the code above configuration for ? (PIC)

can you tell me how to generate the conf word ?
Which PIC are you using.?

hi TT,
When you post a question you must give more details or explanation of what it is you are trying to do, at the moment I have to keep guessing what you want.:)

Try OPTIONS 'configuration bits'
 
Last edited:

Attachments

  • AAesp02.gif
    AAesp02.gif
    68.1 KB · Views: 412
  • AAesp03.gif
    AAesp03.gif
    40 KB · Views: 389
i try your suggestion

but it have two words

Define CONF_WORD = 0x2F14
Define CONF_WORD_2 = 0x3EFF

what should i select ?

hi,
Why have you chosen these CONFIG settings.??
You have code protect Enabled.
 

Attachments

  • AAesp02.gif
    AAesp02.gif
    69.6 KB · Views: 395
i never understand what does CPD and CP for

what does it for ?

i also want to know the other config for

like LVP what it for if we not even programming with low voltage ?

WRT , FCMEN , BOR and etc ?
 
Last edited:
i never understand what does CPD and CP for

what does it for ?

Its for when you program a PIC and you dont other people to be able to read the program.
I would recommend you keep code protect disabled for your projects.
 
hi
how can i set RA0 as analog input ?

for 16F886

hi TT,
This is the Simulator Forum, this type of question should be asked on the Micro-Controllers forum so that other members can answer.:)
 
hi,
Do you mean like this.?
Code:
'16F886 and 16F88

AllDigital

Define SIMULATION_WAITMS_VALUE = 1

Define LCD_BITS = 4
Define LCD_DREG = PORTB
'Define LCD_DBIT = 8

Define LCD_RSREG = PORTB
Define LCD_RSBIT = 3

Define LCD_EREG = PORTB
Define LCD_EBIT = 2

Define LCD_RWREG = PORTB
Define LCD_RWBIT = 1

Dim adcv0 As Word


TRISA = 1  'RA0 (AN0) is input
TRISB = 0  'PORTB is output

ANSEL = 0x01
'Initialize the A/D converter
ADCON1 = %00000001  'Make AN0 analog inputs,
'make reference voltage = VDD
ADCON0 = %11000001  'A/D clock is internal RC, select AN0

Lcdinit

loop:
Lcdcmdout LcdLine1Home
Adcin 0, adcv0
Lcdout "adc test=", #adcv0, "  "

Goto loop

End
 
i think i just need to add extra line

with this one
Code:
ANSEL = 0x01
ADCON1 = %00000001  
ADCON0 = %11000001
and its works !

problem solved :)

hi,
So when are you going to post your next program....;)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top