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

What wrong!!!!

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



Joined: 20 Oct 2006
Posts: 23

View user's profile Send private message

What wrong!!!!
PostPosted: Sat Feb 24, 2007 2:18 pm     Reply with quote

This is a simple test coding about MAX3100

but I don't Know what i wrong,It can't work anything Display in Hyperterminal.



#include<18f452.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)

#define MAX3100_READ1 0x00
#define MAX3100_READ2 0x00
#define MAX3100_WRITE1 0x80
#define MAX3100_WRITE2 0x00
#define MAX3100_CONFIG1 0xC4
#define MAX3100_CONFIG2 0x0A

#INT_EXT
void max3100_recv_data_isr(void)
{
unsigned char temp;

SPI_WRITE(0x00);
SPI_WRITE2(0x00);
temp = SPI_READ();
temp = SPI_READ2();

SPI_WRITE(0x80);
SPI_WRITE2(0x35);

}

void main (){
setup_spi(spi_master |spi_l_to_h |spi_clk_div_16 );
ext_int_edge(0,H_TO_L);
enable_interrupts(INT_EXT);

enable_interrupts(GLOBAL);
SPI_WRITE(0xC4);
SPI_WRITE2(0x0A);
delay_ms(1000);
for(;;){

SPI_WRITE(0x80);
SPI_WRITE2(0x31);

delay_ms(1000);
}

}
Guest








PostPosted: Sat Feb 24, 2007 2:58 pm     Reply with quote

Soulweed,

Exactly where in your code do you think something should be sent to Hyperterminal? You need to add a #USE RS232 statement to your code to setup the UART, and a printf to actually send something to it!

Chris
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sat Feb 24, 2007 3:07 pm     Reply with quote

Take a look at this. It might help...

http://www.ccsinfo.com/forum/viewtopic.php?t=18427&highlight=max3100
Ttelmah
Guest







PostPosted: Sat Feb 24, 2007 3:40 pm     Reply with quote

There are a number of difficulties in driving the Max3100. If you want to post your email address,I'll send you a set of working drivers for this chip.
The big one is the way the ISR has to be handled. The chip will interrupt for both receive, and transmit events. Hence if there is nothing more left to 'send', you have to reprogram this part of the chip to turn off the transmit interrupt, and when new data bcomes available, reprogram the chip to once more start to interrupt to send characters. Also the interrupt from the Max3100, is a _level_ triggered interrupt, not an 'edge' triggered one as supported by the PIC. This means that if there is more than one character in the receive buffer of the 3100, you must keep looping in the inside the PIC's interrupt handler, till the signal from the 3100 changes state, or the PIC will not respond to the latter characters (since the line remains low).

Best Wishes
soulweed



Joined: 20 Oct 2006
Posts: 23

View user's profile Send private message

PostPosted: Mon Mar 05, 2007 9:04 am     Reply with quote

Ttelmah Please trun again

This is my Email soulweed@gmail.com

Thank alot

wish u have a good thing in your life
Ttelmah
Guest







PostPosted: Mon Mar 05, 2007 10:17 am     Reply with quote

On their way.

Best Wishes
soulweed



Joined: 20 Oct 2006
Posts: 23

View user's profile Send private message

PostPosted: Mon Mar 05, 2007 10:55 am     Reply with quote

I am sorry for my question again

now i checking my inbox but it don't have any mail but i waitting for you..

Thank alot
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