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.
yes it work ( a little hard to set )

lets continue ! :)

OK,
Load, F9, run this button1.bas
Select '8 LED Board', set the pins like this image.
Run the 16F4Key2.exe module, set it like the image.

Use the buttons to light the LED's ,, play with inverted buttons and latching buttons,, OK.?
I have seen that the Blog exe has a colour change on two of the check boxes.?? its not a problem I will change it later.
 

Attachments

  • AAesp03.gif
    AAesp03.gif
    57.2 KB · Views: 408
  • buttons1.bas
    376 bytes · Views: 385
OK,
Load, F9, run this button1.bas
Select '8 LED Board', set the pins like this image.
Run the 16F4Key2.exe module, set it like the image.

Use the buttons to light the LED's ,, play with inverted buttons and latching buttons,, OK.?
I have seen that the Blog exe has a colour change on two of the check boxes.?? its not a problem I will change it later.
it work

just like pust button :)

i also test it the code with my 16F886

its work too :)
 
Last edited:
it work

just like pust button :)

i also test it the code with my 16F886

its work too :)

hi,
Thats good.
I think you should write a simple Basic program of your own and post it, so that I can try it.:)
Choose any modules you wish, lets see what you have learned...I will wait.

OK
For the next part after your testing program...

I think you have a 12F629 PIC on your bench, do you have a PIC programmer.?
An LED and 330R resistor.
If you have it would be a good idea to program a small PIC.
 
hi,
Thats good.
I think you should write a simple Basic program of your own and post it, so that I can try it.:)
Choose any modules you wish, lets see what you have learned...I will wait.

OK
For the next part after your testing program...

I think you have a 12F629 PIC on your bench, do you have a PIC programmer.?
An LED and 330R resistor.
If you have it would be a good idea to program a small PIC.
i have PICKIT2

look at my last post

i take the picture of it :)
 
hi eric

can you tell me how to set/read the analog input ?

hi,
We did that in LCDintro1.bas.
Which part do have a problem with.?

EDIT:
Unzip this and watch the avi video
 

Attachments

  • TTzip1.zip
    191 KB · Views: 357
Last edited:
example :
Code:
if PORTA.0 = >0450 Then 
PORTB.0 = 1
else
PORTB.0 = 0

if PORTA.0 = >1250 Then
PORTB.1 = 1
else
PORTB.1 = 0
please fix it !
if you can , i can depelov the code to something else :)
 
Last edited:
example :
Code:
if PORTA.0 = >0450 Then 
PORTB.0 = 1
else
PORTB.0 = 0

if PORTA.0 = >1250 Then
PORTB.1 = 1
else
PORTB.1 = 0
please fix it !
if you can , i can depelov the code to something else :)
hi,
Your code fragment.

if PORTA.0 = 0450 Then ; this can only be 0 or 1 as its a BIT statement
PORTB.0 = 1
else
PORTB.0 = 0
; the ENDIF is missing!

if PORTA.0 = 1250 Then ; this can only be 0 or 1 as its a BIT statement
PORTB.1 = 1
else
PORTB.1 = 0
; the ENDIF is missing!

Post your full program.
 
Last edited:
hi,
Is this what you are trying to do.?

Code:
loop:

If an0 > 100 Then
PORTC.0 = 1
Else
PORTC.0 = 0
Endif

If an1 > 110 Then
PORTC.1 = 1
Else
PORTC.1 = 0
Endif
Goto loop

End
 

Attachments

  • AAesp05.gif
    AAesp05.gif
    20.5 KB · Views: 391
  • LCDintr2.bas
    3.1 KB · Views: 424
Last edited:
Code:
TRISA = 0xff
TRISB = 0x00

If PORTA.0 = > 450 Then
PORTB.0 = 1
Else
PORTB.0 = 0
Endif

If PORTA.0 = > 1250 Then
PORTB.1 = 1
Else
PORTB.1 = 0
Endif
the script error
what i mean is if the analog input
of PORTA0 up from 450 it will turn on the led on PORTB0
so , what it will be ? :)

EDIT : with only using one analog port .
 
Last edited:
Code:
TRISA = 0xff
TRISB = 0x00

If PORTA.0 = > 450 Then
PORTB.0 = 1
Else
PORTB.0 = 0
Endif

If PORTA.0 = > 1250 Then
PORTB.1 = 1
Else
PORTB.1 = 0
Endif
the script error
what i mean is if the analog input
of PORTA0 up from 450 it will turn on the led on PORTB0
so , what it will be ? :)

EDIT : with only using one analog port .

Post #88 shows how to use the adc, just use an0 for 1 adc and change PORTC.0 to PORTB.0
 
Post #88 shows how to use the adc, just use an0 for 1 adc and change PORTC.0 to PORTB.0
like this one right ?
Code:
loop:

If an0 > 450 Then
PORTB.0 = 1
Else
PORTB.0 = 0
Endif

If an0 > 1250 Then
PORTB.1 = 1
Else
PORTB.1 = 0
Endif
Goto loop

End
it still contain error
in line 0003
please check it ! :)

EDIT :
i want to disable the LCD and only use the led for output
 
Last edited:
like this one right ?
Code:
loop:

If an0 > 450 Then
PORTB.0 = 1
Else
PORTB.0 = 0
Endif

[COLOR=Red]If an0 > 1250 Then[/COLOR]; the maximum value from the 10 bit adc is 1023!!
PORTB.1 = 1
Else
PORTB.1 = 0
Endif
Goto loop

End
it still contain error
in line 0003
please check it ! :)

EDIT :
i want to disable the LCD and only use the led for output

OK,
So you want one adc AN0 that controls just one LED on PORTB.0
Just a minute.


EDIT:
Look at this OneAdc....bas

EDIT2:
Look at this OneAdc_3LED.bas
It lights 3 leds on portb 0.1.2 in sequence
 

Attachments

  • OneAdc-1LED1.bas
    299 bytes · Views: 373
  • OneAdc-3LED2.bas
    468 bytes · Views: 383
Last edited:
OK,
So you want one adc AN0 that controls just one LED on PORTB.0
Just a minute.


EDIT:
Look at this OneAdc....bas

EDIT2:
Look at this OneAdc_3LED.bas
It lights 3 leds on portb 0.1.2 in sequence
thanks , it work

im thinking about making VU meter to replacing LM3914 that doesnt available in my country from this source code :)

i will post the code to make sure

i also want to make documentation about all project that people can do from this thread

in PDF
 
Last edited:
hi eric

can you tell how to change the analog input to VOLTAGE input ?

i(m going to)have some devices that have a voltage output :)

hi,
On OPTIONS select Use Voltages for analog inputs

Or look at the module...image


EDIT:
Look at this zipped avi video, if you want this adc module let me know.
 

Attachments

  • AAesp06.gif
    AAesp06.gif
    13.3 KB · Views: 387
  • AAesp07.gif
    AAesp07.gif
    11.6 KB · Views: 394
  • TT2zip.zip
    117.5 KB · Views: 339
Last edited:
i mean at the script

example =
Code:
if PORTA.0 > 0.3 Then ' in volt
PORTB.0 = 1
else 
PORTB.0 = 0
Endif

also , please check my code
Code:
Define CONF_WORD = 0x3f31
Define SIMULATION_WAITMS_VALUE = 1

AllDigital


Dim an0 As Word

TRISB = 0x00
TRISC = 0x00
ADCON1 = 0x8e


loop:

Adcin 0, an0


If an0 < 125 And an0 > 0 Then
PORTB.0 = 0
Else
PORTB.0 = 1
Endif

If an0 < 250 And an0 > 0 Then
PORTB.1 = 0
Else
PORTB.1 = 1
Endif

If an0 < 375 And an0 > 0 Then
PORTB.2 = 0
Else
PORTB.2 = 1
Endif

If an0 < 500 And an0 > 0 Then
PORTB.3 = 0
Else
PORTB.3 = 1
Endif

If an0 < 625 And an0 > 0 Then
PORTB.4 = 0
Else
PORTB.4 = 1
Endif

If an0 < 750 And an0 > 0 Then
PORTB.5 = 0
Else
PORTB.5 = 1
Endif

If an0 < 825 And an0 > 0 Then
PORTB.6 = 0
Else
PORTB.6 = 1
Endif

If an0 < 1000 And an0 > 0 Then
PORTB.7 = 0
Else
PORTB.7 = 1
Endif

Goto loop

End
start from portb 0 for first led
 
Last edited:
hi
You cannot do this,
if PORTA.0 > 0.3 Then ' in volt; I said earlier that this must be either a 0 or a 1
PORTB.0 = 1
else
PORTB.0 = 0

Endif

I will check your program
 
hi,
Is this what you are trying to do,, portb 0 thru 7 LED's coming on as the voltage rises.??

Code:
TRISC = 0x00
ADCON1 = 0x8e


loop:

Adcin 0, an0


If an0 > 125 Then
PORTB.0 = 1
Else
PORTB.0 = 0
Endif

If an0 > 250 Then
PORTB.1 = 1
Else
PORTB.1 = 0
Endif

If an0 > 375 Then
PORTB.2 = 1
Else
PORTB.2 = 0
Endif

If an0 > 500 Then
PORTB.3 = 1
Else
PORTB.3 = 0
Endif

If an0 > 625 Then
PORTB.4 = 1
Else
PORTB.4 = 0
Endif

If an0 > 750 Then
PORTB.5 = 1
Else
PORTB.5 = 0
Endif

If an0 > 825 Then
PORTB.6 = 1
Else
PORTB.6 = 0
Endif

If an0 > 1000 Then
PORTB.7 = 1
Else
PORTB.7 = 0
Endif

Goto loop

End
 
that one is not voltage

the code above is an analog one

i want you to check it

i cant test it to hardware

what is the code above configuration for ? (PIC)

can you tell me how to generate the conf word ?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top