View previous topic :: View next topic |
Author |
Message |
soulweed
Joined: 20 Oct 2006 Posts: 23
|
What wrong!!!! |
Posted: Sat Feb 24, 2007 2:18 pm |
|
|
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);
}
} |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Sat Feb 24, 2007 2:58 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sat Feb 24, 2007 3:40 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
soulweed
Joined: 20 Oct 2006 Posts: 23
|
|
Posted: Mon Mar 05, 2007 9:04 am |
|
|
Ttelmah Please trun again
This is my Email soulweed@gmail.com
Thank alot
wish u have a good thing in your life |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon Mar 05, 2007 10:17 am |
|
|
On their way.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
soulweed
Joined: 20 Oct 2006 Posts: 23
|
|
Posted: Mon Mar 05, 2007 10:55 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|