CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

!!! Really Need Help (MAX7300 Problem)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ekocakaya



Joined: 13 Aug 2006
Posts: 12

View user's profile Send private message

!!! Really Need Help (MAX7300 Problem)
PostPosted: Wed Aug 16, 2006 2:20 am     Reply with quote

I am using 18F4620 PIC and MAX7300 ANI .I ground AD0 and AD1 pins of MAX7300 for adressing.and using ccs library MAX7300.C but I didnt communicate PIC and MAX yet.I need help for this.I use 4.7k resistors for SCL and SDA.anybody have program example? or what is max7300 adress where I will use this address

Please help me




Code:


#include <18F4620.h>
#fuses NOWDT,INTRC_IO, NOPUT, NOMCLR, BROWNOUT, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
#define OSC_4MHZ | OSC_INTRC
#use delay(clock=4000000)



#include <max7300.c>


void main()
{


int durum,i;
int a=0x0xA0;
high_count = high_start;

max7300_init(0xA0);
setup_oscillator( OSC_8MHZ);
setup_comparator(NC_NC_NC_NC);

do
{
for(i=0;i<255;i++)
{

durum=input_pin_ext(0xA0,12);
if(durum!=0){
OUTPUT_HIGH(PIN_B6);
delay_ms(1000);
OUTPUT_LOW(PIN_B6);


OUTPUT_HIGH(PIN_D5);
delay_ms(1000);
OUTPUT_LOW(PIN_D5);
delay_ms(1000);
OUTPUT_HIGH(PIN_D4);
delay_ms(1000);
OUTPUT_LOW(PIN_D4);
delay_ms(1000);
}
delay_ms(200);
}
OUTPUT_HIGH(PIN_B6);
delay_ms(1000);
OUTPUT_LOW(PIN_B6);

}while(true);

}


Last edited by ekocakaya on Wed Aug 16, 2006 5:53 am; edited 7 times in total
Ttelmah
Guest







PostPosted: Wed Aug 16, 2006 4:17 am     Reply with quote

Turn off html, and use the 'code' buttons to post code. Otherwise it is unreadable.
You need to set MAX7300_CLK (and data), to suit the pins you are using, before including the driver file.
Set the processor oscillator up, before initialising the chip.
Presumably you mean 'AD0' and 'AD1'?. If these are grounded, the device address, is 0x80, not 'A0'.

Best Wishes
ekocakaya



Joined: 13 Aug 2006
Posts: 12

View user's profile Send private message

PostPosted: Wed Aug 16, 2006 4:34 am     Reply with quote

what do you mean with need to set max7300_clk? I still trying but ı didnt system get work? what can I do?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Aug 16, 2006 6:32 am     Reply with quote

ekocakaya wrote:
what do you mean with need to set max7300_clk? I still trying but ı didnt system get work? what can I do?
Look into max7300.c, in the top of this file you see
Code:
#ifndef MAX7300_CLK
   #define MAX7300_CLK  PIN_C3
   #define MAX7300_DATA PIN_C4
#endif
This means that if you don't define the pins to be used for the clock and data lines, than the compiler will set PIN_C3 and PIN_C4 to be used as default.
Change your code to something like
Code:
   #define MAX7300_CLK  PIN_something
   #define MAX7300_DATA PIN_something
   #include <max7300.c>


Last edited by ckielstra on Wed Aug 16, 2006 6:45 am; edited 2 times in total
ekocakaya



Joined: 13 Aug 2006
Posts: 12

View user's profile Send private message

PostPosted: Wed Aug 16, 2006 6:38 am     Reply with quote

I already did it.But still I dont know why it isnt working
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Aug 16, 2006 6:45 am     Reply with quote

Also add the NOLVP fuse to your #fuses line. About 99% of the people are using a high voltage programmer (ICD or similar device) to program the PIC. Otherwise with the LVP configuration bit active (default) you can't use pin B5 for I/O, and when you forget to connect B5 to ground normal program execution will not work reliable.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Aug 16, 2006 6:58 am     Reply with quote

Code:
#use delay(clock=4000000)
...
...
setup_oscillator( OSC_8MHZ);
Why are you changing the clock speed? Now the speed of the delay routines is incorrect. Set the required speed in the #use delay() line and the compiler will set up the correct processor speed in the startup code (you can remove the setup_oscillator call).

I see some lines in your program that are corrupted because of HTML being enabled by default. Add all suggested improvements to your program and then post it again making sure the 'Disable HTML' button is checked.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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