1 / 11

HandyBoard & Interactive C

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 4 entradas para motores 2 botões programáveis, knob, beeper. HandyBoard. Interactive C. Especificações IC

iona-abbott
Download Presentation

HandyBoard & Interactive C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 1038 • 8-bit characters (char) • Variáveis globais (persistent) e locais

  6. Interactive C if (expression) statement-1 else statement-2 • Control flow • If-Else • While • For • Break • NÃO suporta Switch-case 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. Interactive C • Library functions • Motores • Sensores void fd (int m) void bk (int m) void off (int m) void alloff() void ao() void motor(int m, int p) fd((3); bk(0); off(1); int digital (int p) \* returns 1/0 value (true-active/false) *\ int analog (int p)

  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 int start_process( function-call(…), [ticks], [stack-size] ) • Multi-tasking Void main() { int pid; pid=start_process(playmusic()); sleep(1.0); kill_process(pid); }

More Related