erased.....
-------------------------------------------------------------------------------
Excuse me , my question was Confused
So let me put my question: I have a program for micro PIC16F616
MY program is 990 WORD.( less, then 2k Word)
Under what circumstances is in need of change PCLATH:
1. When I use the GOTO statement.
2. When I use the CALL command.
3. When the PCL change. For example: ADDWF PCL, F
help me ! for PCLATH
Moderators: Chuckt, Garth, bitfogav
-
- newbie
- Posts: 3
- Joined: Sat Oct 01, 2016 7:01 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
help me ! for PCLATH
Last edited by ALEX001 on Mon Oct 03, 2016 12:58 am, edited 3 times in total.
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: help me ! for PCLATH
I haven't used Assembly with PIC's in quite a number of years - however could you give some more detail about your project?
-
- newbie
- Posts: 3
- Joined: Sat Oct 01, 2016 7:01 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: help me ! for PCLATH
Excuse me , my question was Confused
So let me put my question: I have a program for micro PIC16F616
MY program is 990 WORD.( less, then 2k Word)
Under what circumstances is in need of change PCLATH:
1. When I use the GOTO statement.
2. When I use the CALL command.
3. When the PCL change. For example: ADDWF PCL, F
So let me put my question: I have a program for micro PIC16F616
MY program is 990 WORD.( less, then 2k Word)
Under what circumstances is in need of change PCLATH:
1. When I use the GOTO statement.
2. When I use the CALL command.
3. When the PCL change. For example: ADDWF PCL, F
Re: help me ! for PCLATH
I've brought quite a few products to market with PIC16's, but the last big PIC programming project was finished over two years ago so I'm getting a little rusty on that stuff and I had to look it up to make sure I'm not steering you wrong.
If you are only using page 0, you do not need to write to PCLATH (Program Counter LATch, High byte) for GOTO or CALL.
Even if you never leave page 0, when modifying PCL, you need to write to PCLATH if it might not already point to the same 256-byte page section as the intended destination.
You don't need to modify PCLATH before a RETURN or RETLW; but if later you do call a subroutine or table outside page 0, you'll want to put PCLATH back to the current page after the return so that subsequent GOTOs or CALLs intended for the same page don't go to the other page again.
If you allow interrupts when the program pointer is outside page 0 and the ISR (interrupt-service routine) might modify PCLATH, the ISR will have to save PCLATH's value first and then restore it before the RETFIE.
If you are only using page 0, you do not need to write to PCLATH (Program Counter LATch, High byte) for GOTO or CALL.
Even if you never leave page 0, when modifying PCL, you need to write to PCLATH if it might not already point to the same 256-byte page section as the intended destination.
You don't need to modify PCLATH before a RETURN or RETLW; but if later you do call a subroutine or table outside page 0, you'll want to put PCLATH back to the current page after the return so that subsequent GOTOs or CALLs intended for the same page don't go to the other page again.
If you allow interrupts when the program pointer is outside page 0 and the ISR (interrupt-service routine) might modify PCLATH, the ISR will have to save PCLATH's value first and then restore it before the RETFIE.
http://WilsonMinesCo.com/ lots of 6502 resources
-
- newbie
- Posts: 3
- Joined: Sat Oct 01, 2016 7:01 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: help me ! for PCLATH
Many thanks for your very quick replyGarth wrote:I've brought quite a few products to market with PIC16's, but the last big PIC programming project was finished over two years ago so I'm getting a little rusty on that stuff and I had to look it up to make sure I'm not steering you wrong.
If you are only using page 0, you do not need to write to PCLATH (Program Counter LATch, High byte) for GOTO or CALL.
Even if you never leave page 0, when modifying PCL, you need to write to PCLATH if it might not already point to the same 256-byte page section as the intended destination.
You don't need to modify PCLATH before a RETURN or RETLW; but if later you do call a subroutine or table outside page 0, you'll want to put PCLATH back to the current page after the return so that subsequent GOTOs or CALLs intended for the same page don't go to the other page again.
If you allow interrupts when the program pointer is outside page 0 and the ISR (interrupt-service routine) might modify PCLATH, the ISR will have to save PCLATH's value first and then restore it before the RETFIE.
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: help me ! for PCLATH
Thanks for the great help there Garth.
I am incredibly rusty on my PIC16 ASM code. 2009 was the last I used it I think and even then, I had very little to do with the high side of the program counter.
I am incredibly rusty on my PIC16 ASM code. 2009 was the last I used it I think and even then, I had very little to do with the high side of the program counter.
Who is online
Users browsing this forum: No registered users and 3 guests