View previous topic :: View next topic |
Author |
Message |
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
18C452 and PCH 3077 does input_d() work? |
Posted: Fri Mar 08, 2002 11:45 am |
|
|
<font face="Courier New" size=-1>I may have completely misunderstood the port d i/o
but looking at the assembler below input_d() reads the latch...
but the latch is the last value output from the PIC not the value at the port
#include <18C452.h>
#DEVICE *=16
#fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT
#use delay(clock=20 000 000)
.................... #fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT
....................
....................
.................... #use delay(clock=20 000 000)
....................
.................... main()
.................... {
.................... int data;
0004: CLRF FEA
0006: CLRF FE9
0008: CLRF FC1
.................... while(1)
.................... {
.................... data=input_d();
000A: MOVLW FF
000C: MOVWF F95
000E: MOVFF F8C,06
.................... }
0012: GOTO 000A
.................... } </font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 3067 |
|
|
Hans Wedemeyer Guest
|
Re: 18C452 and PCH 3077 does input_d() work? |
Posted: Sat Mar 09, 2002 11:54 am |
|
|
I just compiled your code using
#use fast_io(D) , if your program can handle the direct access
to port D it will be faster and more campact code.
.................... #device PIC18C452
.................... #list
....................
.................... #DEVICE *=16
....................
.................... #fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT
.................... #use delay(clock=20 000 000)
.................... #use fast_io(D)
.................... main()
.................... {
.................... int data;
0004: CLRF FEA
0006: CLRF FE9
0008: CLRF FC1
....................
.................... data = 0;
000A: CLRF 06
....................
.................... while(1)
.................... {
.................... data=input_d();
000C: MOVFF F83,06
.................... }
0010: GOTO 000C
....................
.................... }
___________________________
This message was ported from CCS's old forum
Original Post ID: 3084 |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
Re: 18C452 and PCH 3077 does input_d() work? |
Posted: Sat Mar 09, 2002 5:06 pm |
|
|
Hans you must be using a different complier version than 3077
3077 gave me this.
F8c as you know is the latch so it could never if I have it right read the input at the port. The code you showed me with F83 the port would work but 3077 doesn't generate it.
CCS PCH C Compiler, Version 3.077
Filename: C:\PICC\PROJECT\WEBSRVR\TESTH.LST
ROM used: 10 (0\%)
Largest free fragment is 16374
RAM used: 6 (0\%) at main() level
6 (0\%) worst case
Stack: 0 locations
*
0000: GOTO 0004
.................... #include <18C452.h>
.................... //////// Standard Header file for the PIC18C452 device ////////////////
.................... #device PIC18C452
.................... #list
....................
.................... #DEVICE *=16
....................
....................
.................... #fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT
....................
....................
.................... #use delay(clock=20 000 000)
....................
.................... #USE FAST_IO(d)
.................... main()
.................... {
.................... int data;
0004: CLRF FEA
0006: CLRF FE9
0008: CLRF FC1
....................
.................... while(1)
.................... {
.................... data=input_d();
000A: MOVFF F8C,06
.................... }
000E: GOTO 000A
.................... }
....................
0012: SLEEP
___________________________
This message was ported from CCS's old forum
Original Post ID: 3091 |
|
|
Hans Wedemeyer Guest
|
Re: 18C452 and PCH 3077 does input_d() work? |
Posted: Sat Mar 09, 2002 9:12 pm |
|
|
Your are bang on target.... I downloaded it but have not installed it yet... I just chekced I used 3.075 !
Sorry abotu that. Anyway that is interesting. I think you have just established a bug, you know of of those things that got broken when something else was fixed ! PCH has had it's share of them!
:=Hans you must be using a different complier version than 3077
:=3077 gave me this.
:=F8c as you know is the latch so it could never if I have it right read the input at the port.
The code you showed me with F83 the port would work but 3077 doesn't generate it.
If that will work for you. You can do it in assembly. Just copy paste from the lst..
Excuse me if you already know this...
Something like this
#byte _PortD_ = 0XF83 // some where in the header
int data;
while(1)
{
#asm MOVFF _PortD_,data #endasm
}
Hope this helps.
PS I'll not install 3.077 and wait for 3.078
PPS will you report this bug to CCS tech support? They don't always monitor the public board.
___________________________
This message was ported from CCS's old forum
Original Post ID: 3094 |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
Re: 18C452 and PCH 3077 does input_d() work? |
Posted: Sun Mar 10, 2002 8:49 am |
|
|
Thanks Hans ...you're a great help.
The bug is reported to CCS....
I'm new to the PIC18 assembler so I was looking for a confirmation since this bug is very severe in that it prevents all port input I thought it must be me (misunderstanding the assembler).
I did use an assembler patch like yours (actually yours is better) to get my code working.
PCH isn't perfect but I experienced a PCM to PCH conversion of several hundred lines resulting in 1 bug albeit a severe one. Approx 1 bug per thousand lines of code...and an almost instant 2 line fix for it (I could do myself in assembler) ...good work CCS!.. light years ahead of any microsoftie experience I have had (I now wait two years before installing a new softie OS to avoid the bugs and security wormholes).
___________________________
This message was ported from CCS's old forum
Original Post ID: 3107 |
|
|
|