PIC Simulator

Status
Not open for further replies.
hi eric

can you tell me what is the difference between SOFT UART and HARDWARE UART ?

hi,
The hardware UART is a logic block that exists in the PIC and it controls all the bit timing to create RS232 signals.
A software only exists in the program, you have to create the bit timing etc within the program in order to meet the RS232 specification for the signals.
 
hi
i just uploaded new program

just a simple program that mixed i from code to code

i dont know what to explain , maybe i will be just post the code

so you can have a try
 

Attachments

  • LCD On - Off.bas
    448 bytes · Views: 363
  • lcdoff.png
    605.8 KB · Views: 394
  • lcdon.png
    573.1 KB · Views: 400
Last edited:
hi,
It works fine for me, whats supposed to be wrong.?

Did you have this line Define SIMULATION_WAITMS_VALUE = 1 just under AllDigital.???
 
ok , i add it to the code

hi TT,
Try my version.

AllDigital

Define SIMULATION_WAITMS_VALUE = 1

Define LCD_BITS = 8
Define LCD_DREG = PORTB
Define LCD_DBIT = 0
Define LCD_RSREG = PORTA
Define LCD_RSBIT = 1
Define LCD_EREG = PORTA
Define LCD_EBIT = 3
Define LCD_RWREG = PORTA
Define LCD_RWBIT = 2

Lcdinit

TRISA = 1
TRISC = 0

Lcdout "PORTA.0 = "
loop:
Lcdcmdout LcdLine1Pos(11)

If PORTA.0 = 1 Then
Lcdout "ON "
PORTC.4 = 1
PORTC.5 = 0
Else

Lcdout "OFF"
PORTC.5 = 1
PORTC.4 = 0
Endif
WaitMs 1000
Goto loop
 
its work ok too
 
Thanks! Found it, Should help immensely helpful in a project I am playing with.What I'm trying to do is write user defineable graphics (8 at a time) to the screen, update the UDG's and reprint them to a different area fo the screen etc. creating a (sort of) dot addressable display on a alphanumeric screen.I understand the limitations I will run up against not least the gaps between characters, but it fascinates me to see how far this can be taken.I have managed to get 32 different chars on a 2x16 display so it is possible.
Ultimately I would like to write an Interupt driven 'Blitter' to dot scroll some sort of large graphic.Proberably not very practical but appeals to my hardware hacker nature.
 
i have LCD ( 16x2 ), some LEDs , some NPN transistor , LDR , Motor , and four servo , 2 7 segment display and Pickit 2 ( for UART communication )

what do you suggest ?
 
hi eric

how can i make analog input become two ?

like " value PORTA.0 = 500 "
....." value PORTA.1 = 200 "
 
Last edited:
hi eric

how can i make analog input become two ?

like " value PORTA.0 = 500 "
....." value PORTA.1 = 200 "

hi,
Look at 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
Dim adcv1 As Word

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

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

Lcdinit

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

Adcin 1, adcv1

Lcdcmdout LcdLine2Home
Lcdout "adc1 test=", #adcv1, "  "

Goto loop

End
 
thanks

it work

i will show my new code after i finished it
 
hi

i do a little research

i think i only need to change the code to this

Code:
[COLOR="red"]ANSEL = 0x07  'make RA0, RA1 and RA2 Analog Input[/COLOR]
'Initialize the A/D converter
ADCON1 = 0
'make reference voltage = VDD
ADCON0 = %11000101  'A/D clock is internal RC, select AN0
 
Last edited:
hi

i have just finished my new code

ALREADY TESTED IN REAL WORLD

it can count up to 1000 rather than 255 , right ?

**broken link removed**

i will upload the video later
 

Attachments

  • softuart2.bas
    505 bytes · Views: 345
Last edited:
hi,
I will give your softuart2.bas a run in Oshonsoft
Code:
Define SEROUT_DELAYUS = 500

Dim i As Word  'to declare i as word not byte because Byte is just only around 256
i = 1000  'make i to 1000
WaitMs 1000  '1000 ms delay
For i = 1 To 1000 Step 1  'from 1 to 1000 , +1 every Step
Serout PORTB.7, 9600, "Number: ", #i, CrLf  'set and use portb.7 to send data and set baud rate to 9600
WaitMs 500  'delay 500 ms
Next i  'step again
[COLOR=Blue]
'this section of the code is incomplete.??[/COLOR]
loop:
Serin PORTB.6, 9600, i  'things that will be displayed at uart window
Serout PORTB.7, 9600, "Number: ", #i, CrLf
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…