Jump to content
LMPForum

transfomer

Full Member
  • Posts

    6
  • Joined

  • Last visited

transfomer's Achievements

Apprentice

Apprentice (3/14)

  • First Post Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. if anyone know it ,please tell me,thanks i use at24c02 EEPROM in my circuit, just use one ,according to some data online, if you use 1 EEPROM ,then A0,A1,A2 can hang in the air,and i do it, but the circuit doesnt work,will it must connect to the ground?or a pull up resistance will success?
  2. The high current regulator uses an additional winding or a separate transformer to supply power for the LM317 regulator so that the pass transistors can operate closer to saturation and improve efficiency. For good efficiency the voltage at the collectors of the two parallel 2N3055 pass transistors should be close to the output voltage. The LM317 requires a couple extra volts on the input side, plus the emitter/base drop of the 3055s, plus whatever is lost across the (0.1 ohm) equalizing resistors (1volt at 10 amps), so a separate transformer and rectifier/filter circuit is used that is a few volts higher than the output voltage. The LM317 will provide over 1 amp of current to drive the bases of the pass transistors and assumming a gain of 10 the combination should deliver 15 amps or more. The LM317 always operates with a voltage difference of 1.2 between the output terminal and adjustment terminal and requires a minimum load of 10mA, so a 75 ohm resistor was chosen which will draw (1.2/75 = 16mA). This same current flows through the emitter resistor of the 2N3904 which produces about a 1 volt drop across the 62 ohm resistor and 1.7 volts at the base. The output voltage is set with the voltage divider (1K/560) so that 1.7 volts is applied to the 3904 base when the output is 5 volts. For 13 volt operation, the 1K resistor could be adjusted to around 3.6K. The regulator has no output short circuit protection so the output probably should be fused. contact with me if you need the schametic
  3. http://www.dzsc.com/data/uploadfile/2008425105430490.jpg i found this circuit in a site ,just carrying out it ,i use RS232 before ,will rs485 the same to it ,is there a differ in program TL750L05,SN75LBC184
  4. transfomer

    Lcd12864

    /************************************************************ MCU:ATega16L 8MHz ************************************************************/ #include <mega16.h> //#include <delay.h> //#include <stdio.h> #include "hzk.h" /*LCD引脚定义 PB0-7对应LCD DB0-DB7*/ #define CS1 PORTA.6 #define CS2 PORTA.5 #define RS PORTA.2 #define RW PORTA.3 #define E PORTA.4 #define RST PORTA.7 #define SPEAK PORTA.0 #define LCDEL PORTA.1 #define MOTO1A PORTD.6 #define MOTO1B PORTD.7 #define MOTO2A PORTC.0 #define MOTO2B PORTC.1 #define HD7279CS 0 #define HD7279CLK 1 #define HD7279DATA 4 #define HD7279KEY 5 #define PD2 2 #define PD3 3 #define URSEL 7 //#define UMSEL 6 //#define UPM1 5 //#define UPM0 4 //#define USBS 3 #define UCSZ1 2 #define UCSZ0 1 //#define UCPOL 0 #define RXCIE 7 #define TXCIE 6 #define UDRIE 5 #define RXEN 4 #define TXEN 3 #define UCSZ2 2 #define RXB8 1 #define TXB8 0 #define RXC 7 #define TXC 6 #define UDRE 5 #define FE 4 #define DOR 3 #define OVR 3 /*This definition differs from the databook*/ #define PE 2 #define U2X 1 #define MPCM 0 typedef const struct { unsigned char X; unsigned char Y; }LCDPos; LCDPos const LCDInfo[]={{0x28,0x00},{0x30,0x00},{0x38,0x00},{0x40,0x00},{0x48,0x00}, {0x50,0x00},{0x58,0x00}, {0x30,0x02},{0x38,0x02},{0x40,0x02}, {0x48,0x02},{0x50,0x02}, {0x30,0x04},{0x40,0x04}, {0x30,0x06},{0x40,0x06},{0x48,0x06}}; unsigned char LCDInfoBuf[17]; int Count = 1234; void delay_us(int time) { do { time--; } while (time>1); } void Delay(int x) { int i,j; for(j=0;j<x;j++) { for(i=0;i<250;i++); } } unsigned char receive_byte(void) { unsigned char i,temp=0; DDRD &= ~(1<<HD7279DATA); delay_us(90); for(i=0;i<8;i++) { temp=temp<<1; PORTD |= (1<<HD7279CLK); delay_us(10); if((PIND & (1<<HD7279DATA))!=0) temp|=0x01; PORTD &= ~(1<<HD7279CLK); delay_us(10); } DDRD |= (1<<HD7279DATA); return temp; } void send_byte(unsigned char para) { unsigned char i; PORTD &= ~(1<<HD7279CS); delay_us(90); for(i=0;i<8;i++) { if((para&0x80)==0x80) PORTD |= (1<<HD7279DATA); else PORTD &= ~(1<<HD7279DATA); PORTD |= (1<<HD7279CLK); delay_us(10); PORTD &= ~(1<<HD7279CLK); delay_us(10); para=para<<1; } } void write7279(unsigned char cmd1, unsigned char cmd2) { send_byte (cmd1); send_byte (cmd2); PORTD |= (1<<HD7279CS); } void Rst7279(void) { send_byte(0xa4); PORTD |= (1<<HD7279CS); } unsigned char Read7279(void) { unsigned char keyval; if((PIND & (1<<HD7279KEY))==0) { send_byte(0x15); keyval=receive_byte(); PORTD |= (1<<HD7279CS); return keyval; } return 0xff; } void LCD_NOP(void) { unsigned char i; for(i=0;i<50;i++); // #asm("NOP"); } void LCD_Write_ComL(unsigned char x) { CS1=0; CS2=1; LCD_NOP(); RS=0; E=1; LCD_NOP(); RW=0; PORTB=x; E=1; E=0; CS1=1; CS2=1; } void LCD_Write_DatL(unsigned char x) { CS1=0; CS2=1; LCD_NOP(); RS=0; E=1; LCD_NOP(); RS=1; RW=0; PORTB=x; E=1; E=0; CS1=1; CS2=1; } void LCD_Write_ComR(unsigned char x) { CS1=1; CS2=0; LCD_NOP(); RS=0; E=1; LCD_NOP(); RW=0; PORTB=x; E=1; E=0; CS1=1; CS2=1; } void LCD_Write_DatR(unsigned char x) { CS1=1; CS2=0; LCD_NOP(); RS=0; E=1; LCD_NOP(); RS=1; RW=0; PORTB=x; E=1; E=0; CS1=1; CS2=1; } void LCD_Init(void) { RST = 1; RST = 0; Delay(200); RST = 1; LCD_Write_ComL(0x3e); LCD_Write_ComR(0x3e); LCD_Write_ComL(0x3f); LCD_Write_ComR(0x3f); LCD_Write_ComL(0xc0); LCD_Write_ComR(0xc0); } void LCD_Clr(void) { unsigned char i,j; for(j=0;j<8;j++) { LCD_Write_ComL(0xb8|j); LCD_Write_ComL(0x40); LCD_Write_ComR(0xb8|j); LCD_Write_ComR(0x40); for(i=0;i<64;i++) { LCD_Write_DatL(0x00); LCD_Write_DatR(0x00); } } } void CCW_PR(unsigned int neima,unsigned char X,unsigned char Y,unsigned char fan) { unsigned char k,com,dat1,hz; unsigned int i; Y=Y|0xb8; LCD_Write_ComL(Y); LCD_Write_ComR(Y); if(neima<CB1B1) hz=8; else hz=0; if(X<0x40) { com=X+0x40; LCD_Write_ComL(com); k='L'; } else { com=X; LCD_Write_ComR(X); //Com=X-0x40+0x40 } com=com&0x3f; for(i=neima;i<(16+neima-hz);i++) { dat1=hzdot; if(fan) dat1=~dat1; if(k=='L') { LCD_Write_DatL(dat1); } else { LCD_Write_DatR(dat1); } com++; if(com==0x40) { LCD_Write_ComR(com); k='R'; } } Y++; LCD_Write_ComL(Y); LCD_Write_ComR(Y); if(X<0x40) { com=X|0x40; LCD_Write_ComL(com); k='L'; } else { com=X; LCD_Write_ComR(X); //Com=X-0x40+0x40 } com=com&0x3f; for(i=(16+neima-hz);i<(32+neima-hz-hz);i++) { dat1=hzdot; if(fan) dat1=~dat1; if(k=='L') { LCD_Write_DatL(dat1); } else { LCD_Write_DatR(dat1); } com++; if(com==0x40) { LCD_Write_ComR(com); k='R'; } } } void logo(void) { CCW_PR(CB5E7,0x4-2,0x06,0); CCW_PR(CBBB0,0x14-2,0x06,0); CCW_PR(CHAR_30,0x28-2,0x06,0); CCW_PR(CHAR_31,0x30-2,0x06,0); CCW_PR(CHAR_32,0x38-2,0x06,0); CCW_PR(CHAR_33,0x40-2,0x06,0); CCW_PR(CHAR_34,0x48-2,0x06,0); CCW_PR(CHAR_35,0x50-2,0x06,0); CCW_PR(CHAR_36,0x58-2,0x06,0); CCW_PR(CHAR_37,0x60-2,0x06,0); CCW_PR(CHAR_38,0x68-2,0x06,0); CCW_PR(CHAR_39,0x70-2,0x06,0); // CCW_PR(ASC0,0x78-2,0x06,0); } // External Interrupt 0 service routine interrupt [EXT_INT0] void ext_int0_isr(void) { // Place your code here if(PIND & (1<<PD3)) Count++; else Count--; } //主程序 void main(void) { unsigned int i; unsigned char Key; DDRB=0xff; PORTB=0x00; DDRA=0xff; DDRC = 0xff; PORTC = 0x00; // Port D initialization // Func7=Out Func6=Out Func5=In Func4=Out Func3=In Func2=In Func1=Out Func0=Out // State7=0 State6=0 State5=P State4=0 State3=P State2=P State1=0 State0=0 PORTD=0x2C; DDRD=0xD3; // External Interrupt(s) initialization // INT0: On // INT0 Mode: Rising Edge // INT1: Off // INT2: Off GICR|=0x40; MCUCR=0x03; MCUCSR=0x00; GIFR=0x40; Rst7279(); #asm("wdr"); #asm("SEI"); //开总中断 LCD_Init(); //LCD初始化 LCD_Clr(); //LCD清屏 MOTO1A = 0; MOTO1B = 1; MOTO2A = 0; MOTO2B = 1; SPEAK = 1; LCDEL = 1; logo(); Delay(200); Delay(200); while(1) { Key = Read7279(); if(Key != 0xff) Count = Key; LCDInfoBuf[0]=(Count/10000)%10; LCDInfoBuf[1]=(Count/1000)%10; LCDInfoBuf[2]=(Count/100)%10; LCDInfoBuf[3]=(Count/10)%10; LCDInfoBuf[4]=(Count)%10; for (i=0;i<7;i++) { CCW_PR(LCDInfoBuf*16,LCDInfo.X,LCDInfo.Y,0); } } }
  5. ;**************************************************** ;* 877I2CA.asm * ;* Very simple I2C sample program without Display * ;**************************************************** ;******************************************************************************* *********** ; This source code provides a demonstration of the MSSP peripheral ; on the PIC16F877 MCU. ; The additional external subroutine are used for LCD Module ; PIC16F877 执行频率 : 4 Mhz ; ; The subroutines for I2C ; :I2C_BYTE_READ ; Read a Byte from Address I2C_Addr and put into I2C_Data ; :I2C_BYTE_WRITE ; Write to I2C_Addr with data @ I2C_Data ; :I2C_ACK_CHECK ; Wait until I2C device can accept further command ; :InitI2C ; Initial I2C Module ; :StartI2C ; Set START Condition !! ; :StopI2C ; Set STOP Condition ; :RstartI2C ; Set Restart Condition ; :RecI2C ; Enable I2C Receive ; :ACKI2C ; Initial ACK response ; :NACKI2C ; Initial NACK response ; :WaitI2C ; Wait until SSPIF Set ;******************************************************************************* ************** list p=16f877 #include <p16f877.inc> CBLOCK 0x20 I2C_Data I2C_Addr ENDC w_temp EQU 0x72 status_temp EQU 0x73 pclath_temp EQU 0x74 ;******************************************** ; Locates startup code @ the reset vector ;******************************************** Reset_Addr org 0x00 nop goto Prog_Main nop nop ;*************************************************************************** ;**** The Start Address of ISR is 0x004 ;**** "PUSH" & "POP" 的使用范例 : 适用于像 PIC16F877 有SHARE BANK 的 PIC ;*************************************************************************** PUSH movwf w_temp ; save off current W register contents movf STATUS,w ; move status register into W register movwf status_temp ; save off contents of STATUS register movf PCLATH,W movwf pclath_temp POP movf pclath_temp,W movwf PCLATH movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interrupt ;---------------------------------------------------------------------- Prog_Main BANKSEL TRISB ; Select Bank 1 movlw b'11000000' ; setup PORTB movwf TRISB BSF OPTION_REG,NOT_RBPU ; Disable PORTB pull-ups BCF STATUS, RP0 ; Select Bank 0 call InitI2C Main: BANKSEL I2C_Addr movlw 0x18 movwf I2C_Addr ; BANKSEL I2C_Data ; Bank Switching, in case its bank is differ than I2C_Addr !! movlw 0x99 movwf I2C_Data ; call I2C_BYTE_WRITE ; Write to I2C Device when Address & Data are set OK call I2C_ACK_CHECK ; Check the ACK response, Wait until the Device Acknowledge ; Issue !! The subroutine will not return until the device send ACK !! ; ; BANKSEL I2C_Addr movlw 0x18 movwf I2C_Addr ; call I2C_BYTE_READ nop ; nop ; goto $ ;**************************************************************************** I2C_BYTE_READ: ; Read a Byte @ I2C_Addr to Buffer I2C_Data ;**************************************************************************** call StartI2C ; Set SSPCON2.SEN call WaitI2C ; Wait PIR1,SSPIF BANKSEL SSPBUF movlw B'10100000' ; Write Command movwf SSPBUF call WaitI2C BANKSEL I2C_Addr ; The "BANKSEL" may not necessary if I2C_Addr is @ the same bank with SSPBUF movf I2C_Addr,W ; The Address you wish to "READ" from BANKSEL SSPBUF movwf SSPBUF call WaitI2C call RstartI2C ; Restart Condition !! call WaitI2C ; Wait Until Restart OK !! BANKSEL SSPBUF movlw B'10100001' ; Write Read Command movwf SSPBUF call WaitI2C call RecI2C ; Enable I2C Receive call WaitI2C ; Wait Until Buffer Received BANKSEL SSPBUF movf SSPBUF,W ; Save to I2C_Data First !! BANKSEL I2C_Data movwf I2C_Data call NACKI2C ; Initial NACK Response !! call WaitI2C ; Wait until NACK sent out call StopI2C ; Initial STOP Condition call WaitI2C ; Wait Until STOP Condition Terminated return ;**************************************************************************** I2C_ACK_CHECK: ; Read a Byte @ I2C_Addr to Buffer I2C_Data ;**************************************************************************** call StartI2C ; Set SSPCON2.SEN call WaitI2C ; Wait PIR1,SSPIF BANKSEL SSPBUF movlw B'10100001' ; Read Command movwf SSPBUF call WaitI2C BANKSEL SSPCON2 btfss SSPCON2,ACKSTAT ; Check ACKSTAT bit , 0 = ACK , 1 = NACK goto ACK_Return call StopI2C call WaitI2C goto I2C_ACK_CHECK ACK_Return: call StopI2C ; Initial STOP Condition call WaitI2C ; Wait Until STOP Condition Terminated return ;**************************************************************************** I2C_BYTE_WRITE: ; Write a Byte to I2C_Addr with I2C_Data ;**************************************************************************** call StartI2C ; Set SSPCON2.SEN call WaitI2C ; Wait PIR1,SSPIF BANKSEL SSPBUF movlw B'10100000' ; Write Command movwf SSPBUF call WaitI2C BANKSEL I2C_Addr ; The "BANKSEL" may not necessary if I2C_Addr is @ the same bank with SSPBUF movf I2C_Addr,W ; The Address you wish to "READ" from BANKSEL SSPBUF movwf SSPBUF call WaitI2C BANKSEL I2C_Data movf I2C_Data,W BANKSEL SSPBUF movwf SSPBUF call WaitI2C call StopI2C ; Initial STOP Condition call WaitI2C ; Wait Until STOP Condition Terminated return ;********************************************************************** ; The following subroutines perform commonly used I2C functions. ;********************************************************************** InitI2C: ; The subroutine of I2C Initialization BANKSEL TRISC movlw B'00011000' ; Initial PortC,bit 3 & 4 as Input movwf TRISC ; RC3 = SCL , RC4 = SDA BANKSEL PORTC movlw 0xff movwf PORTC movlw 0x09 ; This gives 100KHz I2C clock @ 4MHz banksel SSPADD movwf SSPADD movlw b'10000000' ; Disable slew rate control. banksel SSPSTAT movwf SSPSTAT movlw b'00000000' ; movwf SSPCON2 ; Setup MSSP for continuous reception. movlw b'00101000' ; Enable MSSP and setup for I2C master banksel SSPCON ; mode. movwf SSPCON return StartI2C ; Initiate the I2C START condition. banksel SSPCON2 bsf SSPCON2,SEN return StopI2C ; Initiate the I2C STOP condition. banksel SSPCON2 bsf SSPCON2,PEN return RstartI2C ; Initiate the I2C restart condition. banksel SSPCON2 bsf SSPCON2,RSEN return NACKI2C banksel SSPCON2 bsf SSPCON2,ACKDT ; Set the ACK bit bsf SSPCON2,ACKEN ; Initiate the NACK sequence. return ACKI2C banksel SSPCON2 bcf SSPCON2,ACKDT ; Clear the ACK bit bsf SSPCON2,ACKEN ; Initiate the NACK sequence. return RecI2C banksel SSPCON2 ; bsf SSPCON2,RCEN ; Set the receive enable bit. return WaitI2C ; Poll for SSPIF banksel PIR1 FLoop btfss PIR1,SSPIF goto FLoop bcf PIR1,SSPIF return ;---------------------------------------------------------------------- end ; *********** End Of Program !!!!!
  6. i m using lpc2214 processor and lpc flash utility for programming the same. my lpc flash utility cann't read Device-ID from lpc2214.it doesn't communicate with the lpc2214 board. The lpc2214 processor is working as my previously programmed code works successfully, but i m not able to reprogramm it again. so kindly suggest some way out of it.
×
×
  • Create New...