Trích:
Nguyên văn bởi falleaf
Danh sách linh kiện cơ bản bao gồm:
Bill Of Materials July 25,2009 10:36:15 Page1
Item Quantity Reference Part
_____________________________________________
1 2 C11,C12 0.01uF
2 2 C13,C14 22p
3 3 C15,C16,C17 0.1uF
4 1 C18 10uF
5 3 C19,C20,C21 0.1uF
6 1 D1 LED
7 2 J4,J5 CON6
8 1 L1 CHOKE
9 2 R9,R16 1K
10 4 R17,R18,R19,R20 51
11 2 R21,R22 1k2
12 1 R23 4k7
13 2 R24,R25 1.8k
14 1 R26 10k
15 1 R28 R
16 1 U6_EUI 24AA02E48_SOT23 (Microchip MAC Address EEPROM)
17 1 U12 RJ45 W/Mag
18 1 U13 PIC18F67J60-I/PT (Microchip)
19 1 Y1 25MHz
Do file quá nặng, F đang tìm cách để chuyển lên một cái host nào đó. Tạm thời F gửi lên cho các bạn cái schematics như hình dưới đây.
Chúc vui
|
Bang chủ coi cái code này có phải dùng cho con pic 18f97j60 trong ứng dụng phát wifi không?vì mình thấy con wifi(module ZG2100 được điều khiển thông qua giao tiep SPI)
nên nhờ ban chủ và mọi người giúp cho.cảm ơn nhiều!!!
* 2009 Microchip Technology Inc.
*
* FileName: spi_master.c
* Dependencies: Header (.h) files if applicable, see below
* Processor: PIC18F
* Compiler: MCC18 v3.30 or higher
*
* SOFTWARE LICENSE AGREEMENT:
* Microchip Technology Incorporated ("Microchip") retains all
* ownership and intellectual property rights in the code accompanying
* this message and in all derivatives hereto. You may use this code,
* and any derivatives created by any person or entity by or on your
* behalf, exclusively with Microchip's proprietary products. Your
* acceptance and/or use of this code constitutes agreement to the
* terms and conditions of this notice.
*
* CODE ACCOMPANYING THIS MESSAGE IS SUPPLIED BY MICROCHIP "AS IS". NO
* WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
* NOT LIMITED TO, IMPLIED WARRANTIES OF NON-INFRINGEMENT,
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS
* CODE, ITS INTERACTION WITH MICROCHIP'S PRODUCTS, COMBINATION WITH
* ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
*
* YOU ACKNOWLEDGE AND AGREE THAT, IN NO EVENT, SHALL MICROCHIP BE
* LIABLE, WHETHER IN CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR
* BREACH OF STATUTORY DUTY), STRICT LIABILITY, INDEMNITY,
* CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, SPECIAL, PUNITIVE,
* EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, FOR COST OR
* EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE CODE, HOWSOEVER
* CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE
* DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWABLE BY LAW,
* MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS
* CODE, SHALL NOT EXCEED THE PRICE YOU PAID DIRECTLY TO MICROCHIP
* SPECIFICALLY TO HAVE THIS CODE DEVELOPED.
*
* You agree that you are solely responsible for testing the code and
* determining its suitability. Microchip has no obligation to modify,
* test, certify, or support the code.
*
* REVISION HISTORY:
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
* Author Date Comments on this revision
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
* Harsha.J.M 04/04/09 First release of source file
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
*
* ADDITIONAL NOTES:
* Code uses the Peripheral library support available with MCC18 Compiler
* Code Tested on:
* PicDem2+ demo board with PIC18F4685 controller
* The Processor starts with the External Crystal (8 Mhz).
*
* SDO,SDI & SCK must be connected to the corresponding in slave
* MASTER SLAVE
*
* SDO <------------> SDI
* SDI <------------> SDO
* SCk <------------> SCK
* NOTE: Refer Slave source code also
************************************************** ********************/
#define USE_OR_MASKS
#include <p18cxxx.h>
#include "spi.h"
//-------------------------------Configuration setting ----------------------------------------------
/**
* Oscillator is configured as HS
* Fail safe monitor is enabled
* watch dog timer is disabled
* Extended instruction mode is disabled
* oscillator switch over is enabled
*/
#if defined(__18F4685) //If the selected device if PIC18F4685, then apply below settings else user will have to set
#pragma config OSC=HS, FCMEN=ON, WDT=OFF, IESO=ON, XINST=OFF, LVP=OFF
#endif
unsigned char SPI_Send[21] = "MICROCHIP_SPI_MASTER";
unsigned char SPI_Recv[21];
//****************** SPI MASTER *******************************
//************************************************** ************
void main(void)
{
unsigned char sync_mode=0;
unsigned char bus_mode=0;
unsigned char smp_phase=0;
unsigned char w=0;
CloseSPI(); // Turn off SPI modules if was previosly on
//***********Configure SPI MASTER module to transmit in master mode ************
sync_mode = SPI_FOSC_64 ;
bus_mode = MODE_01;
smp_phase = SMPMID;
OpenSPI(sync_mode,bus_mode,smp_phase );
//********** WRITE INITIAL CHARECTER ************************************
while(WriteSPI(0xF5)); //send initial charecter to use the same as flag at slave side and send it till successful transmision
//********** WRITE THE STRING TO SPI ***************************************
putsSPI(SPI_Send); //send the string of data to be sent to slave
//********* Read the initial flag id **********************************************
if( 0xF5 == ReadSPI() )
{
getsSPI(SPI_Recv,20); // read the string sent from slave
SPI_Recv[20] = '\0' ; //terminate the string with a null charecter
}
/* Turn off SPI module and clear IF bit */
CloseSPI();
while(1); //End of program
}
cái này mình cần sữa những gì nữa mong được giúp đỡ.cảm ơn mọi người and ban chủ!!