AN696 motor application in sample folder

Discussion on both general simulation and Proteus VSM microcontroller simulation.
Post Reply
picchiedi
Professional User
Posts: 142
Joined: Thu 2014-12-25 9:32

AN696 motor application in sample folder

Post by picchiedi »

Hello.

In the application note instructions it is said that if you do not use virtual terminal to start the motor, dip switches 1,2,3,4 are used with the memorized profile segments.
But when I switch on the switches and I run I have no movement and don't understand why.

In the application note instuctions it is said that to start you can use <CR> or comma. Shall I type <CR> or comma or what...?
What is <CR>.

Thank you for any kind clarification.

Regards
Ettore
Labcenter Staff
Posts: 2932
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: AN696 motor application in sample folder

Post by Ettore »

As Microchip's code has been wrote is unlikely that stand-alone operation work as described. The pin RE2 needs to be brought high in order to run any profile on the motor. and this only happens in the code when the command W<CR> is typed on the terminal. If you want such a feature to work you should add the following lines to the end of void Setup(void) function and recompile the code:

Code: Select all

if (stat.run)
   PORTEbits.RE2 = 1;
Once you have made this code modification then you will select the DIP2, 3 or 4 and then press the $MCLR button as the application note says.


The application note says that <CR> or comma is used as delimiter characters for command sequence. What you have to type and the correct sequence is listed in the command summary you find in the description or, much better, condensed in the table directly on the Proteus schematic.

<CR> means carriage return, the return key on your PC keyboard.
Kind regards,
Ettore Arena - Labcenter Electronics.
picchiedi
Professional User
Posts: 142
Joined: Thu 2014-12-25 9:32

Re: AN696 motor application in sample folder

Post by picchiedi »

Many thanks Ettore ,for your kind answer!

What I still miss is the reason why, if I type in virtual terminal X,0,32000, or type X,0,10000, the travelled distance of the motor (Upcount variable) does not change.
I should expect in the first case 32000/500= 64 revolutions and in the second 10000/500=20 revolutions until stop.
I don't really catch where my input data go (in which part of the RAM).
I found it not clear in application note explanation.

Thanks again.

Regards
Ettore
Labcenter Staff
Posts: 2932
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: AN696 motor application in sample folder

Post by Ettore »

Settings from terminal commands are stored to U5, I2C E2PROM. So, open the Debug menu when in pause and click to I2C Memory Internal Memory U5 item. Distance to be travelled is stored in the first two bytes. We didn't write that code, so I'm not entirely sure but you should type the following commands in the virtual Terminal in order to initialize the U5 memory.

Code: Select all

X,0,32000<CR>   
V,0,100<CR>   
A,0,200<CR> 
P,3<CR>   
D,-10<CR> 
G,0,0<CR>
W<CR>
(for command summary look at the table of Proteus circuit)
Remember to press always <CR> to enter any command.
When a profile is completed (possibly you can type S<CR> to stop current profile) then enter:

Code: Select all

X,0,10000<CR>
G,0,0<CR>
this would execute the profile with new distance.

All that I have presumed by looking at the code. For more details you should perhaps ask to shed some light in the Microchip's forum.
Kind regards,
Ettore Arena - Labcenter Electronics.
picchiedi
Professional User
Posts: 142
Joined: Thu 2014-12-25 9:32

Re: AN696 motor application in sample folder

Post by picchiedi »

Thank you very much, Ettore, for your kind assistance.

Regards.
Post Reply