![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
roberth Guest
|
Need help with program 18F452 |
Posted: Tue Nov 05, 2002 6:06 am |
|
|
Hi,
I there anything wrong with this program, all I want to do is put a hight state (+5v) on port A & B on a 18F452..
And one more thing, has anyone have problem with programming
hexfiles with a "Universal Programmer", like Labtool-48, when I swap the bytes in the hexfiles the programmer programmes the config-bits correct but the program doesn't start, I have a nice OSC signal. I'm using PCH v3.114
--------------------------------------------------------------
#include <18F452.h>
#device *=16
#FUSES HS,NOWDT,NOPROTECT,PUT,BROWNOUT
#ID CHECKSUM
#ZERO_RAM
#use DELAY(CLOCK=7372800)
#use fast_io(A)
#use fast_io(B)
#BYTE PORTB = 0xF81
#BYTE PORTA = 0xF80
SET_TRIS_A(0);
SET_TRIS_B(0);
void main(void)
{
PORTA = 0xFF;
PORTB = 0xFF;
}
--------------------------------------------------------------
Best regards,
Robert
___________________________
This message was ported from CCS's old forum
Original Post ID: 8539 |
|
![](templates/subSilver/images/spacer.gif) |
Hans Wedemeyer Guest
|
Re: Need help with program 18F452 |
Posted: Tue Nov 05, 2002 10:08 am |
|
|
Put set_trisX() in the main()
#include <18F452.h>
#device *=16
#FUSES HS,NOWDT,NOPROTECT,PUT,BROWNOUT
#ID CHECKSUM
#ZERO_RAM
#use DELAY(CLOCK=7372800)
#use fast_io(A)
#use fast_io(B)
#BYTE PORTB = 0xF81
#BYTE PORTA = 0xF80
void main(void)
{
int i=0;
SET_TRIS_A(0);
SET_TRIS_B(0);
PORTA = 0xFF;
PORTB = 0xFF;
// just to allow you to see(with scope) what's happening
while(1)
{
PORTA = i;
i++;
delay_us(100);
PORTB = i;
delay_us(100);
}
}
:=--------------------------------------------------------------
:=
:=Best regards,
:=Robert
:=
:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 8556 |
|
![](templates/subSilver/images/spacer.gif) |
Ivar Johnsrud Guest
|
Re: Need help with program 18F452 |
Posted: Tue Nov 05, 2002 11:55 am |
|
|
:=You would also need to set porta to digital:
:=
:=Put set_trisX() in the main()
:=
:=#include <18F452.h>
:=#device *=16
:=#FUSES HS,NOWDT,NOPROTECT,PUT,BROWNOUT
:=#ID CHECKSUM
:=#ZERO_RAM
:=#use DELAY(CLOCK=7372800)
:=#use fast_io(A)
:=#use fast_io(B)
:=#BYTE PORTB = 0xF81
:=#BYTE PORTA = 0xF80
:=
:=void main(void)
:={
:= int i=0;
:=
:= setup_adc(NO_ANALOGS);
:= SET_TRIS_A(0);
:= SET_TRIS_B(0);
:= PORTA = 0xFF;
:= PORTB = 0xFF;
:=
:= // just to allow you to see(with scope) what's happening
:= while(1)
:= {
:= PORTA = i;
:= i++;
:= delay_us(100);
:= PORTB = i;
:= delay_us(100);
:= }
:=
:=}
:=:=--------------------------------------------------------------
:=:=
:=:=Best regards,
:=:=Robert
:=:=
:=:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 8565 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|