البته تراشه های مترجم سطح نیز وجود دارد... (مشابه max232)
اگر تغذیه میکرو 3.3V باشه... با این بافر نیاز نداری البته محدودیت سرعت هم باید در نظر گرفت
از نظر من بهتره تغذیه میکرو ات هم 3.3 باشه. و هیچ واسطی نداشته باشی...
ولی سری dspic30f4013 که من کار کردم 5 ولتیه!!! پروگرمر من هم pic kit نوآوران.
بعدم من این برنامه رو نوشتم ولی روی ال سی دی چیزی نمایش داده نمیشه(یه سری عبارات بی معنی)
// LCD module connections
sbit LCD_RS at LATB4_bit;
sbit LCD_EN at LATB6_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB6_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
// duplex config flags
#define Spi_Ethernet_HALFDUPLEX 0x00 // half duplex
#define Spi_Ethernet_FULLDUPLEX 0x01 // full duplex
// mE ehternet NIC pinout
sfr sbit SPI_Ethernet_Rst at LATF0_bit; // for writing to output pin always use latch
sfr sbit SPI_Ethernet_CS at LATF1_bit; // for writing to output pin always use latch
sfr sbit SPI_Ethernet_Rst_Direction at TRISF0_bit;
sfr sbit SPI_Ethernet_CS_Direction at TRISF1_bit;
/***********************************
* RAM variables
*/
unsigned char myMacAddr[6] = {0x00, 0x14, 0xA5, 0x76, 0x19, 0x3f}; // my MAC address
unsigned char myIpAddr[4] = {192, 168, 20, 60 }; // my IP address
unsigned char gwIpAddr[4] = {192, 168, 20, 6 }; // gateway (router) IP address
unsigned char ipMask[4] = {255, 255, 255, 0 }; // network mask (for example : 255.255.255.0)
unsigned char dnsIpAddr[4] = {192, 168, 20, 1 }; // DNS server IP address
unsigned short len=0;
unsigned char getRequest[1000];
// HTTP request buffer
//* no reply to UDP requests
unsigned int SPI_Ethernet_UserUDP(unsigned char *remoteHost, unsigned int remotePort, unsigned int destPort, unsigned int reqLength)
{
return(0);
}
// get 10 first bytes only of the request, the rest does not matter here
unsigned int SPI_Ethernet_UserTCP(unsigned char *remoteHost, unsigned int remotePort, unsigned int localPort, unsigned int reqLength, char *canClose)
{
// should we close tcp socket after response is sent?
// library closes tcp socket by default if canClose flag is not reset here
// *canClose = 0; // 0 - do not close socket
// otherwise - close socket
if(localPort != 21) // I listen only to ftp request on port 80
{
return(0);
}
SPI_Ethernet_getBytes(getRequest,0x00,100);
return(0); // return to the library with the number of bytes to transmit
}
void main()
{
ADPCFG |= 0xFFFF; // all digital
PORTB = 0;
TRISB = 0; // set PORTB as input for buttons and adc
PORTD = 0;
TRISD = 0; // set PORTD as output,
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
lcd_out(1,1,"Hi HEGAS...."
Delay_ms(2000);
// dhcp will not be used here, so use preconfigured addresses
SPI_Ethernet_confNetwork(ipMask, gwIpAddr, dnsIpAddr);
while(1) // do forever
{
/*
* if necessary, test the return value to get error code
*/
SPI_Ethernet_doPacket(); // process incoming Ethernet packets
if( SPI_Ethernet_doPacket()==0) {
while(1)
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
lcd_chr(1,1,getRequest[len]);
delay_ms(1000);
len=len+1 ;
}
/*
* add your stuff here if needed
* Spi_Ethernet_doPacket() must be called as often as possible
* otherwise packets could be lost
*/
}
}
}
در درجه اول بهتره که از پروگرامر PIC KIT3 استفاده کنید.
چون امکاناتی بهتون میده که پروگرامر نوآوران نداره.
پروگرامرتون رو روی مد Low voltage بزارید وکانفیگBOR میکرو هم چک کنید.(Borrow Out)
این کنترلر ها با ولتاژ 3.3 کارآیی بهتری دارند..
برنامه تون مال کتابه نیستش؟؟؟
اتصالات LCD ردیفن؟
کلاک پالس میزونه؟
ضمناً مطمئن شو که پایه ها فقط ورودی یا فقط خروجی نیستند!
دیدگاه