본문 바로가기

전체 글

(88)
[PHP] php 로 mysql 데이터 가져오기. $link = mysql_connect("localhost", "root", "1234") or die("MySQL Connection Error.");$select = mysql_select_db ("db");if (!$select) { echo "DB Selection Error."; exit;}$query = "select count(*) from {$table_name} where column1='{$column1}'";$result = mysql_query($query);$count = mysql_result($result, 0, 0);mysql_close($link);?>$conn = mysqli_connect('localhost', $id, $pw, $db) or die(mysql_error..
[PHP] php session 예제. $_SESSION['temp'] 는 session_destroy() 나 unset($_SESSION['temp']) 을 만나기 전까지 페이지를 벗어나도 유지합니다. isset($_SESSION['temp']) 을 이용하여 해당 세션값의 유무를 판단 할 수 있습니다. 아래는 그 예제 입니다. if(isset($_SESSION['temp'])) { echo "temp is not empty.";}
Visual Studio 모든 설정 초기화 하는 방법. 시작 -> Microsoft Visual Studio -> Visual Studio Tools -> 명령 프롬프트(또는 개발자 명령 프롬프트) 아래의 명령어를 입력합니다. devenv /resetuserdata
ATmega128 - USART 패킷 단위 소스코드. #define headerData 0xff unsigned char checkSum = 0; Transmit() { checkSum = (char)(data1 + data2 + data3); printf(headerData); printf(data1); printf(data2); printf(data3); printf(checkSum);} unsigned char rxdDataBuffer = 0;unsigned char rxdDataState = 0;unsigned char rxdDataPacketCount = 0;unsigned char rxdDataPacket[6];unsigned char rxdDataError = 0;unsigned char rxdDataBufferCheckSum = 0;unsig..
ATmega128 - 리모콘 수신 프로그램 (업그레이드). #define F_CPU 16000000UL #include #include #include #include #define CLK 16000000#define PRESCALE 256#define TIME_US 100#define TIMER0_CNT (CLK*TIME_US/(256*1000000)) char _remocon_counter,_save_remocon,_flg_remocon;char bit_input;char bounce_check = 0; unsigned char _remocon_custom,_remocon_custom_2;unsigned char _remocon_data,_remocon_data_2; int _counter_remocon; void port_init() { DDRA = 0xf..
ATmega128 - PWM 제어 예제. #define F_CPU 16000000UL #include #include #include void port_init() { DDRA = 0xff; PORTA = 0x00; DDRB = 0xff; PORTB = 0x00; DDRC = 0xff; PORTC = 0x00; DDRD = 0xff; PORTD = 0x00; DDRE = 0xff; PORTE = 0x00; DDRF = 0xff; PORTF = 0x00; DDRG = 0xff; PORTG = 0x00;} int main(void) { unsigned char i = 0; unsigned char j = 0; _delay_ms(500); port_init(); // FOC0:0, WGM00:1, COM01:1, COM00:0, WGM01:0, CS..
ATmega128 - 적외선 신호(리모콘 신호) 수신 동작 소스. // 일반 송신 함수void usart_tx_byte(u08 tx_data){ while(!(UCSRA&0x20)); UDR=tx_data; UCSRA|=0x20;} // 송신할 데이터를 16진 데이터로 변형후 송신void usart_tx_byte_hex(u08 tx_hex_data){ unsigned char h_data, l_data; l_data=tx_hex_data&0x0f; h_data=tx_hex_data>>4; if(h_data
ATmega128 - DS1620 디지털 온도계 동작 소스. #define dir_pin DDRB#define out_pin PORTB#define in_pin PINB #define dq_out_set (dir_pin=0xff)#define dq_in_set (dir_pin=0xfe) #define clk_conv_low (out_pin&=0xfd)#define clk_conv_high (out_pin|=0x02)#define reset_low (out_pin&=0xfb)#define reset_high (out_pin|=0x04) #define ds1620_comm_read_temp (0xaa)#define ds1620_comm_write_th (0x01)#define ds1620_comm_write_tl (0x02)#define ds1620_comm_read..