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.

Beginning with PIC Simulator IDE

Status
Not open for further replies.

micol

New Member
Hello,

I have the whole package for PIC and PIC18. Full versions (not trial).

On yesterday, I tried "PIC 18 Getting Started". All works well except "Run to next basic statement" which stays inactive (grey).

Now, I am trying "Getting started" with the other version (not 18) and program timer0.bas and I have exactly the same problem.
Why cannot I acced to this function ?

second question (only by curiousity) :
What is the use of lines with R0L to R9H found in the beginning of all compiled files ?

have a good sunday
 
Hello,

I have the whole package for PIC and PIC18. Full versions (not trial).

On yesterday, I tried "PIC 18 Getting Started". All works well except "Run to next basic statement" which stays inactive (grey).
If you are using the Assembler function, the 'Run to Next Basic' is not enabled.
Its only enabled for Basic compiler, Use STEP in assembler

Now, I am trying "Getting started" with the other version (not 18) and program timer0.bas and I have exactly the same problem.
Why cannot I acced to this function ?

second question (only by curiousity) :
What is the use of lines with R0L to R9H found in the beginning of all compiled files ?
These are General Purpose Registers [GPR] used by the assemble program, Oshonsoft reserves these GPR's for its program

have a good sunday

Hi,
If you post your full program listing I can run it in Oshonsoft and help to debug it with you.
Use the
Code:
'#'
symbol on the Menu above to enclose your list, in that way it will retain the code formatting.
 
Last edited:
If you are using the Assembler function, the 'Run to Next Basic' is not enabled.
Its only enabled for Basic compiler, Use STEP in assembler
I guessed this but not understood why il does not works even when i load .bas file and key "F9".

If you post your full program listing I can run it in Oshonsoft and help to debug it with you.
I have not yet personnal programs : I use Oshonsotf exemples.
 
I guessed this but not understood why il does not works even when i load .bas file and key "F9".

I have not yet personnal programs : I use Oshonsotf exemples.

hi,
Try this using Basic.
Set the RATE to Step by Step, this then should allow the Run to Next Basic

If you want the program to RUN at full Rate and then want to STEP at a particular point in the program , add a BREAK instruction at that point in the program list.

So when you Run the program it will Run at the Ultimate Rate until it reaches the BREAK command, after that you can use the Run to Next Basic.

Let me know how it goes.
 
Hi,

I tried and wrote any data into a 4550 using USB.

Here is part of the VB5 code, happening when we click on "Test" button :

Dim bienEcrit As Boolean
Dim i As Integer
If (hexProd = "8888") And (hexVdr = "6245") Then
Text2.Text = "C'est bien lui"

For i = 0 To 10
BufferOut(i) = i
Next

bienEcrit = hidWriteEx(ceVendeur, ceProduit, BufferOut(0))

If bienEcrit Then
Text2.Text = Text2.Text & ". " & "écriture exécutée."
Else
Text2.Text = Text2.Text & ". " & "écriture ratée."
End If

End If

and part of PIC code, adapted from Oshonsoft:

usbonftout:
Toggle PORTB.7
Return
usbonftin:
Toggle PORTB.5
For i = 0 To 7
UsbFtBuffer(i) = UsbFtBuffer(i) - 1
Next i
Return

usbonioout:
Toggle PORTB.6
Return
usbonioin:
Toggle PORTB.4
For i = 0 To 7
UsbFtBuffer(i) = UsbFtBuffer(i) + 1
Next i
Return

I put resistors and leds on each pin of PORTB.
These leds shine quickly on plug-in but never after.

When I clik on the TEST button :
1st time, I get the message "écriture exécutée."
2nd time : no action, even if I clicked on other buttons between 1st and second click.
3rd time : the program freezes. All buttons are blocked until I unplug USB wire and then the program closes itself.

**broken link removed**

I did not progress much during last 2 months. I shall look at package USB_Term2 as soon as I receive 2550 and displays recently ordered from Hong-Kong.

Merry Christmas to everybody on this forum.

Michel
 
Last edited:
Hi,

I changed my purpose. I copied, studied, modified HIDTerminal.

Something is worrying : there are subroutines called before sending anything to PC, but no way to send without being requiered.
Exemple of what I need : sending some values to PC when I push on a button on the board.
I know 18F4550 allows this kind of things. I did a programm who does so witn Microchip C18 and I seek how doing the same with OshonSoft pack.

I read "getting started", and several exemples on this forum (USB_Demo1/2/3.bas) whithout finding any Basic command sending data to PC.

:(
 
Last edited:
Hi,

I changed my purpose. I copied, studied, modified HIDTerminal.

Something is worrying : there are subroutines called before sending anything to PC, but no way to send without being requiered.
Exemple of what I need : sending some values to PC when I push on a button on the board.
I know 18F4550 allows this kind of things. I did a programm who does so witn Microchip C18 and I seek how doing the same with OshonSoft pack.

I read "getting started", and several exemples on this forum (USB_Demo1/2/3.bas) whithout finding any Basic command sending data to PC.

:(

hi,
If I understand correctly what you are asking for, ? this is an example of a PIC to PC data transfer, using the Report and Feature buffers

Code:
 'preload Feature array, before calling service 
f1(0) = "P"
f1(1) = "O"
f1(2) = "R"
f1(3) = "T"
f1(4) = "A"
f1(5) = "="
f1(6) = 0x20  '''''Note the IDE will not allow a space of " "
f1(7) = PORTA And 0xfc  'read PORTA digital inputs
f1(7) = ShiftRight(f1(7), 2)  'move to lower nibble
f1(7) = f1(7) Or 0x30  'make ascii

 'preload Report array with ascii value, before calling service 
r1(0) = "V"
r1(1) = "0"
r1(2) = "="
r1(3) = asc1(3)
r1(4) = "."
r1(5) = asc1(2)
r1(6) = asc1(1)
r1(7) = asc1(0)


UsbService '  This Command starts the PIC to PC transfer
 
Last edited:
Thank you for your quick answer.

Now, I see better where is the problem. It is on the PC side. Your example (and what I tried before) sends data to PC . But the PC does not read it because nothing tells it : "it is time to HIDReadReport" .

The problem is in the dll, not so complete as mcHID.dll in which "setReadNotify" does this.

I shall explore this way.

:)
 
Last edited:
No result :eek:

From Oshonsoft hidTerminal, I made a VB6 program using both mcHID.dll and hidterm.dll. This prog receives datas from board when he asked for them but not those send spontaneously by the board.

a week later :

I tried another way. I used my first VB6 program (who receives data when PIC contains a programm from MSLab IDE) and wrote a program with PICSimulator with the same result as before.

Now, I give up for a while, begining the learning of another system : Arduino.

View attachment 61109
 
Last edited:
I just read from post #8 :

UsbService ' This Command starts the PIC to PC transfer

does this command also starts de PC to PIC transfer, in other words does this command makes the PIC to wait information??
 
I just read from post #8 :

UsbService ' This Command starts the PIC to PC transfer

does this command also starts de PC to PIC transfer, in other words does this command makes the PIC to wait information??

hi,
The USBService command is required for transfers from the PC to PIC and PIC to PC.

Before calling the USBService, preload your PIC buffers [Report and Feature] 8 Bytes each.

On calling the USBService the the service will read and Save the contents of the 'usbiobuffers' from the PC and then Send the contents of the PIC buffers to the PC, which are read by the PC program.

As its HID its not a very fast transfer rate, I use a Timer in Visual Basic to read the USB buffers at 1mSec intervals. This transfers 2*8 bytes [ the Report and Feature] buffers

Code:
'stores data PC>pcb>PC
usbonioin:
UsbIoBuffer(0) = "0"
UsbIoBuffer(1) = "1"
UsbIoBuffer(2) = "2"
UsbIoBuffer(3) = "3"
UsbIoBuffer(4) = "4"
UsbIoBuffer(5) = "5"
UsbIoBuffer(6) = "6"
UsbIoBuffer(7) = "7"
Return                                            

'store data  PC>pcb>PC
usbonftin:
UsbFtBuffer(0) = "A"
UsbFtBuffer(1) = "B"
UsbFtBuffer(2) = UsbFtBuffer(2) - 1
UsbFtBuffer(3) = UsbFtBuffer(3) - 1
UsbFtBuffer(4) = UsbFtBuffer(4) - 1
UsbFtBuffer(5) = UsbFtBuffer(5) - 1
UsbFtBuffer(6) = UsbFtBuffer(6) - 1
UsbFtBuffer(7) = UsbFtBuffer(7) - 1
Return
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top