336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


Hackerspace (다큐1, 메이커 모임)

제작하며 생기는 수익을 새로운 아이디어를 창출하는데 투자할 계획입니다.

시간이 오래걸리더라도 1인 1작을 원칙으로 합니다.

만드신 것들은 크던, 작던 현금화 하는데 최선을 다해 도와드리겠습니다.

Forum형식이고 주기적인 회의를 통해 아이디어를 아이디어를 공유할 계획입니다.

각자 갖고있는 직업은 절대 관여하지 않습니다.

제시한 아이디어에 대한 소유권을 존중합니다.


참여 자격이 되지않는 사람

1.대학교4학년생 (졸업작품을 위해서 참여할 가능성이 크므로 제한을 두고있습니다.)

2.아이디어제시만 하는사람 (실제로 제작이 가능한 사람이어야 합니다.)

3.부모에게 지나치게 의존하는 어린사람 (모임에 부모가 참여하는 난처한 경우를 피하기 위함입니다.)

4.천천히 배우겠다는 사람 (스터디 그룹보다는 사업성을 띠는 모임을 추구합니다.)

5.나이 성별 제한은 두고있지 않습니다.



진행방향

초보 : Arduino SDK를 이용하는 단계에서 Eclipse에 plug-in하여 개발하는 단계

중급 : AVR혹은 PIC등 microchip으로 넘어와 개발하는 단계

고급 : Android Studio로 App을 개발하여 Arduino와 연계되는 단계

Raspberry Pi, MySQL 연계되는 시스템 설계 단계

위의 3파트로 나눠서 진행합니다.


관심있는 분들 혹은 궁금한 점들은 댓글로 남겨주세요 

이메일 남겨주시면 답변드릴때 편합니다.


#해커스페이스#메이커모임#Hackerspace#4차산업혁명#다큐1#PCB#Eagle#아두이노#Arduino#전자과졸업작품

Posted by ElectricShock
:
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


Naver

Favicon of search.naver.com [pic portb change interrupt]

pic16 예제

[PIC INTERRUPT-ON-Change]





http://www.circuitvalley.com/2012/10/rotary-encoders-interfacing-pic18-avr.html

Rotary Encoder Interfacing with PIC Microcontroller


Rotary Encoder PIC18.zip




Source code 는 총 3개로 나뉘어 있다.

lcd16.h lcd16.c main.c

우선 봐야할 것은 lcd16.h이다.

이 안에있는 #include <p18F458.h>

#include <delays.h>역시 주목해야한다.


p18f458.h


delays.h



▼lcd16.h

#ifndef __lcd16_h_

#define __lcd16_h_


#include <p18F458.h>


#define RS PORTCbits.RC3        //정의한다. RS를 포트C3로

#define EN PORTCbits.RC2        //정의한다. EN을 포트C2로


void numToLcd(unsigned char);                //lcd16.c안의 method참고

void gotoXy(unsigned char  ,unsigned char);    //

void lcdInit(void);

void lcdCmd(unsigned char);

void lcdData(unsigned char);

void lcdWriteNibble(unsigned char);

void waitLcd(unsigned char);

void prints(const rom char * message);

#endif



▼lcd16.c

#include "lcd16.h"


void lcdCmd(unsigned char Data)    //4번 메소드

{

EN=0;

PORTD =((Data >> 4) & 0x0F);

RS=0; //because sending command

EN=1;

waitLcd(2);

EN=0;

PORTD  = (Data & 0x0F);

EN =1;

waitLcd(2);

EN=0;

}



void lcdData(unsigned char l)   //5번 메소드

{

EN=0;

PORTD =((l >> 4) & 0x0F);

RS=1;  //because sending data

EN=1;

waitLcd(2);

EN=0;


PORTD  = (l & 0x0F);

RS=1;  //because sending data

EN=1;

waitLcd(2);

EN=0;

}



void lcdInit(void)    //3번 메소드

{

RS=0;

EN=0;

PORTD= 0x3;

waitLcd(40);

EN=1;

EN=0;

waitLcd(5);

EN=1;

EN=0;

waitLcd(5);

EN=1;

EN=0;

waitLcd(2);

PORTD=2;

EN=1;

EN=0;

lcdCmd(0x28);   //set data length 4 bit 2 line

waitLcd(250); 

lcdCmd(0x0E);   // set display on cursor on blink on

waitLcd(250);

lcdCmd(0x01); // clear lcd 

waitLcd(250);

lcdCmd(0x06);  // cursor shift direction

waitLcd(250);

lcdCmd(0x80);  //set ram address

waitLcd(250);

}



void waitLcd(unsigned char x)

{

unsigned char i;

for (x ;x>1;x--)

{

for (i=0;i<=110;i++);

}

}




//gotoXy(column, row);

void gotoXy(unsigned char  x,unsigned char y)        //2번 메소드

{

     if(x<40)

     {

          if(y) x|=0b01000000;

          x|=0b10000000;

          lcdCmd(x);

      }

}






void prints(const rom char * message){ // Write message to LCD (C string type)

lcdCmd(0x8); // disable display;

while (*message){ // Look for end of string

lcdData(*message++);

}

lcdCmd(0xE); // enable display;

}


void clearLcd(void)

{

// Send command to LCD (0x01)

lcdCmd(0x01);

}


void numToLcd(unsigned char num)        //1번 메소드

{

lcdData((num/100)+0x30);

lcdData(((num/10)%10)+0x30);

lcdData((num%10)+0x30);

}



▼main.c

/* 

 * File:   main.c

 * Author: Gaurav

 *

 * Created on September 2, 2013, 11:49 PM

 */

#pragma config OSC = HS, OSCS = OFF //configuration settings 

#pragma config PWRT= OFF , BOR=OFF, BORV = 27

#pragma config WDT = OFF

#pragma config LVP =OFF , STVR =OFF



#include <p18f458.h> 


#include "lcd16.h" //includes the lcd routines header file, 

//the rotary encoder is not dependent on this 

//but in this demo required to display.

#include <delays.h> //C18 compiler delay routine header file  

/*

 * 관련자료 링크

 *  Delay1KTCYx :: Delay multiples of 1000 Tcy

 *  Delay1TCY :: Nop()

 *  Delay10TCYx :: 2560 cycles

 *  Delay100TCYx :: 25600 cycles

 *  Delay1KTCYx :: 256000 cycles

 */



#define REA LATBbits.LATB4 // Rotary encoder pin definition

#define REB LATBbits.LATB5    //정의한다. REB를 래치 B 비트들중.래치B5 라고

//C18 Header에서 LATBbits에 대해 정의되있다.

//Hi-Tech에서는 다르게 정의한다.


void pbchange(void);

//portb change routine this routine is being called by the interrrupt serivice routine on portb change interrupts

void callISR(void);


#pragma code highPI = 0x008 // to put the code on Interrupt Vector 

void highPI(void)

{

_asm 

goto callISR

 _endasm

}

#pragma code 


#pragma interrupt callISR //checks which one of the interrupt is occured

void callISR(void)

{


 if(INTCONbits.RBIF==1) //check for PortB change interrupt

{

       pbchange(); //call the routine

}


}


unsigned char count; //this variable will incremented or decremented on encoder rotation

void main() {

   

TRISD = 0x00; // set the PORTD to output 

TRISC = 0x00; // set the PORTC to output

    TRISBbits.TRISB4=1; // set rotary encoder pins to input

TRISBbits.TRISB5=1;

lcdInit(); // inilized the LCD

prints("Count = ");  

numToLcd(count); // display count to lcd

INTCON2bits.RBPU  =0; // enable pullups 

INTCONbits.RBIF = 0; // clear the interrupt flag 

INTCONbits.RBIE = 1; // enable PORTB change interrupt

    INTCONbits.GIE  = 1; // enable the global interrupt

while(1)

{


}


}


void pbchange(void )

{

unsigned char state;

static unsigned char oldstate;  // this variable need to be static as it has to retain the value between calls 

Delay1KTCYx(5); // delay for 1ms here for debounce 

state= REB<<1 | REA; //  combine the pin status and assign to state variable 

if(oldstate==0x0){

if( state ==0x1)

{

count--; //decrement the count 

gotoXy(8,0); //goto proper position on the LCD screen

numToLcd(count); //display the count value on to LCD

}else if( state == 0x2)

{

count++; //decrement the count 

gotoXy(8,0); //goto proper position on the LCD screen

numToLcd(count); //display the count value on to LCD

}

}

oldstate = state; // store the current state value to oldstate value this value will be used in next call


PORTB = PORTB; // read or Any read or write of PORTB,This will end the mismatch condition

INTCONbits.RBIF = 0; // clear the porb change intrrupt flag 

}

'졸업작품 > Encoder with PIC MPLAB IDE' 카테고리의 다른 글

Encoder with PIC MPLAB IDE  (1) 2016.01.10
Posted by ElectricShock
:
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

어느날 제 블로그의 애드센스 광고가 뜨지않아서 확인차 계정으로 들어가 봤습니다.

오른쪽 위의 알람이 표시되서 클릭해봤습니다.

애드센스 정책을 위반했다는 문구를 확있했습니다.


무슨일인지 보니

제가 블로그에 추가하면 안되는 컨텐츠를 보함했다는 메세지 였습니다.

해킹관련 컨텐츠였는데 이게 내용때문인지 포함된 첨부파일 때문인지 정확히는 모르겠습니다.

첨부파일을 다운로드하면 바로 백신이 감지하는걸 보니 후자일 가능성이 클듯하네요

그리 치명적인 파일은 아니고 입문자들을 위한 파일이었는데 위험파일로 감지된것일 수도 있고요


여튼 이의신청을 하게되면 위 그림처럼 상태가 의신청 진행중 이라고 바뀝니다.

잘 해결될때까지 기다려봐야겠군요

-----------------------------------------------------------------------------------

추가로 이의신청을 하고자할때 (링크) 클릭

이문제 해결도구 클릭

모두 "예" 를 누르고

https://www.google.com/adsense/app#policy-appeal  여기로 간다.

이의신청 거부됬다고 너무 상심말고, 왜 이의신청이 거부됬는지 보고 수정하길 바랍니다.

Google Adsense의 전화번호가 따로 없는 관계로 시키는대로 하는 방법밖에 없네요 ㅠ





수표로 받은 수익 다시 은행개좌로 재지급 요청하고플때

우선 수표로 받으면 추심비가 생각보다 크게 들어가므로 만료될때 까지 기다린다.

통상 6개월간 수표를 은행에서 추심요청하지않으면 만료상태가 된다.

▼거래내역 확인을 통해서 GoogleCheck(=구글수표)를 제때 찾아가지않아 Delay상태가된 기록을 열람해보자.



▲그럼 위 그림처럼 수익재지급 버튼이 활성화 된다.

이걸 누르면 아래 그림처럼 메세지가 뜬다.

이때 오른쪽 버튼을 눌러주면 된다.

▼그럼 아래 그림처럼 환불 처리중 이라는 메세지를 최신기간에서 확인할 수 있다.

Google Check(=구글수표)는 어떻게 생겼나 호기심에 받아보는건 좋지만

굳이 은행에 가서 현금으로 교환하는건 권하지않는다.

은행에선 그걸 사들여서 확실치 않은 매도로 돌려야하므로 

추심비를 요구한다.

제1금융권 은행에 문의해보니 $50이상은 껀당 $25나간다고하니

저같은 경우는 $112-$25 =수익에 해당한다.

그러므로 굳이 수표로 받아서 은행을 통해 현금화 하고 싶다면 $50미만은 괜찮다는 결론이 나온다.

헌데 국내로 배송되는 기간이 너무 오래걸리니 인내심 깊은 사람이 아니라면 비추~!!!.


Posted by ElectricShock
:

BLOG main image
잡동사니들(지극히 개인취향인...) (다른글에도 댓글 부탁해요♥) You May Leave English Messages on GuestBook. by ElectricShock

공지사항

카테고리

분류 전체보기 (782)
MiDi (2)
Programming(=프로그래밍) (3)
Animation (4)
Blender (3D Graphic Program.. (10)
Blendtuts.com (Series) (1)
Blender 기초 팁들 (2)
Processing (디지털미디어과) (2)
Music (1)
Books in the world (0)
Communication(CAN, UART, et.. (12)
MCU Examples (PIC 기반) (7)
Transistor (1)
Mikro C Pro (11)
Mikro Pascal (1)
Proton IDE (0)
Robot (0)
Swift 3D (1)
Dummies Series (1)
All about Hacking (0)
제2 외국어 (1)
PIC 해외서적들 (3)
AVR (25)
PIC (MikroC) (MPLAB) (4)
Assembly (2)
ARM (3)
Arduino (26)
PSpice (1)
Proteus ISIS (14)
CodeVision (2)
FPGA (15)
MPLAB (24)
PCB (the Procedure) (15)
3D Printer (5)
PICKIT3 (6)
Matlab (11)
RaspBerry PI (15)
BeagleBone (1)
Android Studio (17)
졸업작품 (172)
Korea History (0)
Issue(사회) (73)
Multimeter 리뷰 (1)
Oscilloscope (1)
A (34)
B (19)
J (6)
C (32)
P (12)
T (37)
H (12)
I (12)
M (44)
R (5)
E (5)
F (2)
D (9)
O (2)
L (7)
S (9)
W (2)
V (6)
G (14)
Visual C++ or Visual Studio (2)
Android App Development (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백