A apresentação está carregando. Por favor, espere

A apresentação está carregando. Por favor, espere

HandyBoard & Interactive C. HandyBoard Especificações –Clock de 2 MHz –32 Kb de RAM –7 entradas para sensores analógicos –9 entradas para sensores digitais.

Apresentações semelhantes


Apresentação em tema: "HandyBoard & Interactive C. HandyBoard Especificações –Clock de 2 MHz –32 Kb de RAM –7 entradas para sensores analógicos –9 entradas para sensores digitais."— Transcrição da apresentação:

1 HandyBoard & Interactive C

2 HandyBoard Especificações –Clock de 2 MHz –32 Kb de RAM –7 entradas para sensores analógicos –9 entradas para sensores digitais –4 entradas para motores –2 botões programáveis, knob, beeper

3 HandyBoard

4 Interactive C Especificações –IC –Compilada em um pseudo-código (não código nativo) –Código interpretado pela HandyBoard –Permite checagem de erros em run-time e gera erros, evitando assim crash do sistema (divisão por zero) –Multi-tasking: suporta até 12 processos simultâneos

5 Interactive C Tipos de dados –Case sensitive –16-bit integer (int) -32,768 a +32,767 –32-bit integer (long) -2,147,483,648 a +2,147,483,647 –32-bit floating point (float), precisão de 7 casas decimais, 10 -38 to 10 38 –8-bit characters (char) –Variáveis globais (persistent) e locais

6 Interactive C Control flow –If-Else –While –For –Break –NÃO suporta Switch-case if (expression) statement-1 else statement-2 while (expression) statement int i; for (i = 0; i <100; i++) printf(%d\n, i);

7 Interactive C Vetores int foo[10]; int foo[] = {0, 4, 5, -8, 17, 301}; char string[] = Hello there; int retrieve_element (int index, int array[]) { return array[index]; }

8 Interactive C Apontadores int *foo; int x = 5; int y; foo = &x; y = *foo; void avg_sensor (int port, int *result) { int sum = 0; int i; for (i = 0, i < 10, i ++) sum += analog(port); *result = sum/10; }

9 Library functions –Motores –Sensores Interactive C void fd (int m) void bk (int m) void off (int m) void alloff() void ao() void motor(int m, int p) int digital (int p) \* returns 1/0 value (true-active/false) *\ int analog (int p) fd((3); bk(0); off(1);

10 Interactive C Library functions –Botões e Knob –Tempo –Som int stop_button() \* returns value of STOP *\ int start_button() void stop_press() \* waits for STOP to be pressed,hen released, then beeps *\ void start_press() int knob() \* returns knob position 0 to 255 *\ void sleep(float sec) void msleep(long msec) void beep() void tone(float freq, float length)

11 HandyBoard Multi-tasking int start_process( function-call(…), [ticks], [stack-size] ) Void main() { int pid; pid=start_process(playmusic()); sleep(1.0); kill_process(pid); }


Carregar ppt "HandyBoard & Interactive C. HandyBoard Especificações –Clock de 2 MHz –32 Kb de RAM –7 entradas para sensores analógicos –9 entradas para sensores digitais."

Apresentações semelhantes


Anúncios Google