Hi
(Apologise in advance for the long post)
I am after some help please, we have been given a task to program a PIC "to find the time duration for an automatic vacuum cleaning process".
The automatic vacuum cleaning process is intitiated in some way, either through a timer or manually started and left to run, the process continues until completion at which point the time taken for this process to be completed is displayed on a 7 segment display.
We are given the following assumptions,
That the time recorded should be reasonably accurate, 10ths of a second should be sufficient for this.
That the process will not take longer than 10 minutes, I am not sure how relevant this for either being able to count up or down.
This piece of program is to be called by the main program when required.
We have been told that the code will need three parts:
an initialisation section
an interrrupt section
a delay loop itself
We have been told that the code does not actually need to function but we do need to have some code.
We have also been told that we should be able to find modules of code necessary from the Microchip website and simply copy and paste these to create our own program.
The only problem that I have with this is that I will not learn very much if anything at all.
The code that I have managed to create so far is:
For the delay loop, using the internal 31KHz oscillator:
"
Delay loop
Mov lw 0xff
Mov 0x78
Mov wf count
Move wf count 1
Loop 0
Dec fsz count 60
Goto loop 1
Return
Loop 1
Dec fsz count 1
Goto loop 1
Reset
Goto loop0
End
"
It is help with the initialisation and interrupt parts of the program that I need, as well as constructive comments on the above piece of 'code'.
I know that Jon Wilder created a basic template for the PIC16F887, located at this link:
https://www.electro-tech-online.com...-i-o-setup-template-for-16f887-in-asm.120899/
That contains both an interrupt handler and an intialisation routine.
There is obviously a lot more code in there than what I require.
I could simply take both of these sections of code and add it to what I have created above but I was wondering if someone could possibly offer some advice on the code I have created above for a start.
I would also like to add that prior to this course I have no relevant programming experience, a small amount in C many many years ago is all.
Thanks in advance for any help
Logjkos
(Apologise in advance for the long post)
I am after some help please, we have been given a task to program a PIC "to find the time duration for an automatic vacuum cleaning process".
The automatic vacuum cleaning process is intitiated in some way, either through a timer or manually started and left to run, the process continues until completion at which point the time taken for this process to be completed is displayed on a 7 segment display.
We are given the following assumptions,
That the time recorded should be reasonably accurate, 10ths of a second should be sufficient for this.
That the process will not take longer than 10 minutes, I am not sure how relevant this for either being able to count up or down.
This piece of program is to be called by the main program when required.
We have been told that the code will need three parts:
an initialisation section
an interrrupt section
a delay loop itself
We have been told that the code does not actually need to function but we do need to have some code.
We have also been told that we should be able to find modules of code necessary from the Microchip website and simply copy and paste these to create our own program.
The only problem that I have with this is that I will not learn very much if anything at all.
The code that I have managed to create so far is:
For the delay loop, using the internal 31KHz oscillator:
"
Delay loop
Mov lw 0xff
Mov 0x78
Mov wf count
Move wf count 1
Loop 0
Dec fsz count 60
Goto loop 1
Return
Loop 1
Dec fsz count 1
Goto loop 1
Reset
Goto loop0
End
"
It is help with the initialisation and interrupt parts of the program that I need, as well as constructive comments on the above piece of 'code'.
I know that Jon Wilder created a basic template for the PIC16F887, located at this link:
https://www.electro-tech-online.com...-i-o-setup-template-for-16f887-in-asm.120899/
That contains both an interrupt handler and an intialisation routine.
There is obviously a lot more code in there than what I require.
I could simply take both of these sections of code and add it to what I have created above but I was wondering if someone could possibly offer some advice on the code I have created above for a start.
I would also like to add that prior to this course I have no relevant programming experience, a small amount in C many many years ago is all.
Thanks in advance for any help
Logjkos