embeded/AVR (ATmega,ATtiny)2015. 7. 18. 22:29


PE4/PE5 는 Output Compate (OC3)

PE6은 Timer/counter 3 clk input(T3)

PE7은 Input Capture (IC)

PD쪽은.. 통신을 쓰면 4개 선을 쓰지 못하니

실질적으로 사용가능한 falling edge / rising edge 탐지는 2개 정도 일려나?


결론은.. 핀하나하나 while로 감지 하지 않으려면...

tie-up해서 잡는 수 밖에 없을 것으로 보이네..






External Interrupts

The External Interrupts are triggered by the INT7:0 pins. Observe that, if enabled, the interrupts will trigger even if the INT7:0 pins are configured as outputs. This feature provides a way of generating a software interrupt. The External Interrupts can be triggered by a falling or rising edge or a low level. This is set up as indicated in the specification for the External Interrupt Control Registers – EICRA (INT3:0) and EICRB (INT7:4). When the external interrupt is enabled and is configured as level triggered, the interrupt will trigger as long as the pin is held low. Note that recognition of falling or rising edge interrupts on INT7:4 requires the presence of an I/O clock, described in “Clock Systems and their Distribution” on page 35. Low level interrupts and the edge interrupt on INT3:0 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other than Idle mode. The I/O clock is halted in all sleep modes except Idle mode. Note that if a level triggered interrupt is used for wake-up from Power-down mode, the changed level must be held for some time to wake up the MCU. This makes the MCU less sensitive to noise. The changed level is sampled twice by the Watchdog Oscillator clock. The period of the Watchdog Oscillator is 1µs (nominal) at 5.0V and 25°C. The frequency of the Watchdog Oscillator is voltage dependent as shown in the “Electrical Characteristics” on page 318. The MCU will wake up if the input has the required level during this sampling or if it is held until the end of the start-up time. The start-up time is defined by the SUT fuses as described in “Clock Systems and their Distribution” on page 35. If the level is sampled twice by the Watchdog Oscillator clock but disappears before the end of the start-up time, the MCU will still wake up, but no interrupt will be generated. The required level must be held long enough for the MCU to complete the wake up to trigger the level interrupt.


EICRA와 EICRB는 조금 다르게 설명이 적혀있으니 자세히 읽어 봐야 할 듯..

[링크 : http://www.atmel.com/images/doc2467.pdf]

'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

avr-libc 8bit AVR C++  (0) 2015.07.28
avr twi / i2c 예제 및 풀업관련  (0) 2015.07.19
AVR Studio / AVRdude 연동  (0) 2015.03.12
AVRISP 호환 제품 ?  (0) 2015.03.11
SED1520 데이터시트 / Page, Line, Column  (0) 2014.03.27
Posted by 구차니
embeded/raspberry pi2015. 7. 18. 22:16

초음파 관련 루틴을 while로 처리해서

오차가 있을것으로 생각되다 보니..

인터럽트 처리방식 검색...


gpio 유틸에도 존재는 한다.

gpio edge <pin> rising/falling/both/none

This enables the given pin for edge interrupt triggering on the rising, falling or both edges. (Or none which disables it)

[링크 : http://wiringpi.com/the-gpio-utility/] 


python 버전

GPIO.add_event_detect(17, GPIO.FALLING, callback=my_callback, bouncetime=300)  GPIO.add_event_detect(23, GPIO.FALLING, callback=my_callback2, bouncetime=300)  

[링크 : http://raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio-part-3] 


c 버전

void myInterrupt(void) {

   eventCounter++;

}


int main(void) {

  if (wiringPiSetup () < 0) {

      fprintf (stderr, "Unable to setup wiringPi: %s\n", strerror (errno));

      return 1;

  }


  // set Pin 17/0 generate an interrupt on high-to-low transitions

  // and attach myInterrupt() to the interrupt

  if ( wiringPiISR (BUTTON_PIN, INT_EDGE_FALLING, &myInterrupt) < 0 ) {

      fprintf (stderr, "Unable to setup ISR: %s\n", strerror (errno));

      return 1;

  }


  // display counter value every second.

  while ( 1 ) {

    printf( "%d\n", eventCounter );

    eventCounter = 0;

    delay( 1000 ); // wait 1 second

  }


  return 0;

}

[링크 : http://cs.smith.edu/dftwiki/index.php/Tutorial:_Interrupt-Driven_Event-Counter_on_the_Raspberry_Pi] 



Posted by 구차니
다리 부상으로 누워있을수 밖에 없으니
빔프로젝터가 절실하네...

누워서 잉여롭게 컴퓨터라던가.. 게임이라던가? ㅠㅠ



'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

8월 할일  (0) 2015.08.02
8월...  (0) 2015.08.01
codility 잼나네..  (0) 2015.07.06
자바의 앞날은..  (0) 2015.07.03
아씨... 오실로스코프 하나 질러?  (0) 2015.06.21
Posted by 구차니
embeded/raspberry pi2015. 7. 17. 10:52

전에 쓴적이 있던가?

아무튼.. 지금글을 보고 있노라니..

국제화 관련 설정에서

gb가 기본값이었던거 같은데..

영국에서 만든게 왜...중국이 기본값이 된걸까?

+

2017.09.12

gb는 영국임. Great Britain



키보드 레이아웃은 집에가서 테스트 해봐야지 ..



[링크 : http://raspberrypi.stackexchange.com/questions/1042/why-is-my-symbol-not-working]


~!@#$%^&*()_+| 를 입력한 화면 확실히 먼가 이상하게 나온다.

프랑이라던가? 이.. 미묘한 기호순서라니!

XKBLAYOUT을 gb에서 us로 바꾸고

pi@raspberrypi ~ $ sudo cat /etc/default/keyboard

# KEYBOARD CONFIGURATION FILE


# Consult the keyboard(5) manual page.


XKBMODEL="pc105"

XKBLAYOUT="gb"

XKBVARIANT=""

XKBOPTIONS=""


BACKSPACE="guess" 


setupcon을 해주면 빠르게 설정이 된다는데 ssh나 터미널로는 안된다

pi@raspberrypi ~ $ sudo setupcon

We are not on the console, the console is left unconfigured. 


pi@raspberrypi ~ $ sudo service lightdm stop

ctrl -alt - f1

pi@raspberrypi ~ $ sudo setupcon


아무튼 리부팅 하고 오니

~!@#$%^&*()_+| 

원하는대로 잘 나온다.



Posted by 구차니
개소리 왈왈/블로그2015. 7. 16. 22:11

영.. 회복이 안되네.. -_-

그래도 막 3000~4000 오던게

2000 이하로 ㅋㅋㅋ


그래도 네이버 비율이 그리 낮아지지 않았다는게 참.. 슬프다 -_-

구글 비율이 좀 오르고 전체 방문자가 늘면 좋으련만..



머.. 6월 부터는 계속 2000명대네 ㅋㅋ

방학이라 그런건가?!

'개소리 왈왈 > 블로그' 카테고리의 다른 글

기분전환겸 스킨 변경  (0) 2015.09.04
네이버가.. 50% 돌파?  (2) 2015.07.31
출장여파 ㅋㅋㅋ  (0) 2015.07.12
댓글 알림은 있는데 댓글이 사라졌다?  (4) 2015.06.11
한RSS 역사의 뒤안길로..  (0) 2015.05.14
Posted by 구차니

2014년을 넘겼어!!

전시회 할거야!! 라는 기분? ㅋㅋㅋ





[링크 : http://www.seouladex.com/]

'개소리 왈왈 > 2015 에어쇼' 카테고리의 다른 글

ADEX 2015  (0) 2015.10.27
ADEX 2015 사진은 .. 나중에 ㅠㅠ  (0) 2015.10.25
Posted by 구차니
파일방2015. 7. 15. 12:56

NAS 프로그램인데

라즈베리용도 있다. ㄷㄷ

(그런데 라즈베리 USB 하드라서 속도가 안날텐데.. 게다가 USB로 랜이라...)


[링크 : http://www.openmediavault.org/]

[링크 : http://sourceforge.net/projects/openmediavault/files/]

    [링크 : http://blog.naver.com/mol70/220284425344]

'파일방' 카테고리의 다른 글

HelpNDoc  (0) 2015.07.29
goahead 웹 서버  (0) 2015.07.19
freetype / jam  (0) 2015.06.25
knime - 빅데이터 분석툴  (0) 2015.05.28
redmine / 레드마인  (0) 2015.04.14
Posted by 구차니
프로그램 사용/gcc2015. 7. 14. 16:59


$ cat size.c
#include <stdio.h>
#include <stdint.h>

void main()
{
        int a;
        int64_t b;

        printf("%d\n", sizeof(a));
        printf("%d\n", sizeof(b));

} 


$ ./a.out

4
8


+

#include <stdint.h>를 넣지 않으면 에러가 발생한다.

$ gcc size.c

size.c: In function ‘main’:

size.c:6:2: error: unknown type name ‘int64_t’


2013/01/13 - [프로그램 사용/gcc] - gcc 64bit 확장


Posted by 구차니
프로그램 사용/gcc2015. 7. 14. 16:47

나중에 리눅스 서버 하나 다시 만들어서 해봐야지


These -m switches are supported in addition to the above on AMD x86-64 processors in 64-bit environments.


-m32

-m64

Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture. 


[링크 : https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/i386-and-x86-64-Options.html]


64bit 우분투에서 빌드 하려니 에러가 발생한다. multilib을 설치하라는데..

$ gcc -m32 void.c

In file included from /usr/include/stdio.h:28:0,

                 from void.c:1:

/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory

compilation terminated.


$ sudo apt-get install gcc-multilib

[링크 : http://uce.uniovi.es/tips/Programming/Cpp/forc32bitscompilation.html] 

[링크 : http://stackoverflow.com/questions/22355436/how-to-compile-32-bit-apps-on-64-bit-ubuntu]


'프로그램 사용 > gcc' 카테고리의 다른 글

gcc에서 precompiled header 사용하기  (0) 2015.07.29
gcc 64bit 변수 선언하기  (0) 2015.07.14
gcc 특정 표준 따르도록 강제하기  (0) 2015.07.14
크기가 0인 배열 허용  (0) 2015.06.29
ubuntu gcc가 바보  (2) 2013.09.19
Posted by 구차니
프로그램 사용/gcc2015. 7. 14. 16:34


-ansi

In C mode, this is equivalent to -std=c90. In C++ mode, it is equivalent to -std=c++98.


-std=

A value for this option must be provided; possible values are

‘c90’

‘c89’

‘iso9899:1990’

Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 are disabled). Same as -ansi for C code. 

‘iso9899:199409’

ISO C90 as modified in amendment 1. 

‘c99’

‘c9x’


[링크 : https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html]

'프로그램 사용 > gcc' 카테고리의 다른 글

gcc 64bit 변수 선언하기  (0) 2015.07.14
gcc 32bit/ 64bit 컴파일하기  (0) 2015.07.14
크기가 0인 배열 허용  (0) 2015.06.29
ubuntu gcc가 바보  (2) 2013.09.19
gcc 64bit 확장  (0) 2013.01.13
Posted by 구차니