史也 菅
/
CAN_main
can_main
main.cpp@2:2ee241819861, 2021-09-01 (annotated)
- Committer:
- kurobikari
- Date:
- Wed Sep 01 07:01:56 2021 +0000
- Revision:
- 2:2ee241819861
- Parent:
- 1:7945cd701d0d
aaaa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kurobikari | 0:6322c2c7148c | 1 | #include "mbed.h" |
kurobikari | 2:2ee241819861 | 2 | #include "can.h" |
kurobikari | 0:6322c2c7148c | 3 | |
kurobikari | 2:2ee241819861 | 4 | /* PCへのプリント用 */ |
kurobikari | 2:2ee241819861 | 5 | Serial pc(USBTX, USBRX); |
kurobikari | 0:6322c2c7148c | 6 | |
kurobikari | 2:2ee241819861 | 7 | /* CAN宣言 */ |
kurobikari | 2:2ee241819861 | 8 | YKNCT_MD_CAN MD(PA_11,PA_12,500000);//(rd , td, 周波数, 送信割り込み速度) |
kurobikari | 0:6322c2c7148c | 9 | |
kurobikari | 2:2ee241819861 | 10 | /* ----------------メイン----------------------- */ |
kurobikari | 2:2ee241819861 | 11 | int main(void) |
kurobikari | 2:2ee241819861 | 12 | { |
kurobikari | 2:2ee241819861 | 13 | /* プリントのボーレート設定 */ |
kurobikari | 2:2ee241819861 | 14 | pc.baud(115200); |
kurobikari | 0:6322c2c7148c | 15 | |
kurobikari | 2:2ee241819861 | 16 | /* MD初期化 */ |
kurobikari | 2:2ee241819861 | 17 | MD.Init(0,MD_SMB); |
kurobikari | 2:2ee241819861 | 18 | MD.Init(1,MD_LAP); |
kurobikari | 2:2ee241819861 | 19 | MD.Init(2,MD_SMB); |
kurobikari | 2:2ee241819861 | 20 | MD.Init(3,MD_LAP); |
kurobikari | 2:2ee241819861 | 21 | MD.Init(4,MD_SMB); |
kurobikari | 2:2ee241819861 | 22 | MD.Init(5,MD_LAP); |
kurobikari | 2:2ee241819861 | 23 | MD.Init(6,MD_SMB); |
kurobikari | 2:2ee241819861 | 24 | MD.Init(7,MD_LAP); |
kurobikari | 0:6322c2c7148c | 25 | |
kurobikari | 0:6322c2c7148c | 26 | |
kurobikari | 0:6322c2c7148c | 27 | while(1) { |
kurobikari | 2:2ee241819861 | 28 | /* MD実行 */ |
kurobikari | 2:2ee241819861 | 29 | MD.Set(0,100); |
kurobikari | 2:2ee241819861 | 30 | MD.Set(1,100); |
kurobikari | 2:2ee241819861 | 31 | MD.Set(2,100); |
kurobikari | 2:2ee241819861 | 32 | MD.Set(3,0); |
kurobikari | 2:2ee241819861 | 33 | MD.Set(4,0); |
kurobikari | 2:2ee241819861 | 34 | MD.Set(5,50); |
kurobikari | 2:2ee241819861 | 35 | MD.Set(6,0); |
kurobikari | 2:2ee241819861 | 36 | MD.Set(7,50); |
kurobikari | 1:7945cd701d0d | 37 | |
kurobikari | 2:2ee241819861 | 38 | /* エンコーダ取得 */ |
kurobikari | 2:2ee241819861 | 39 | for(int i=0; i<8; i++) |
kurobikari | 2:2ee241819861 | 40 | pc.printf("%d ",MD.Get_enc(i)); |
kurobikari | 2:2ee241819861 | 41 | pc.printf("\n\r"); |
kurobikari | 0:6322c2c7148c | 42 | |
kurobikari | 2:2ee241819861 | 43 | } |
kurobikari | 2:2ee241819861 | 44 | } |
kurobikari | 0:6322c2c7148c | 45 |