Comments, suggestions, questions about this forum? Post it here! Also for test purposes or Off-Topic discussions.

USB Keyboard with 18F2550

Postby faceu » 15 Nov 2016, 11:39

I'm trying to build my own mechanical keyboard. Everyone uses Teensy as for as i can see. I wanna use PIC18F2550 instead(see datasheet here.). I'm using CCS C btw. The problem is, i can't send more than 5 bits at all. Tried to send different arrays, they collide somehow. Increasing report count from "usb_desc_keyboard.h" doesn't work. "usb_puts" function didn't work either.

When i send multiple arrays, one by one, PIC sends key characters. No problem there. But it doesn't make the same response as a regular keyboard. Normally, first type takes longer time than others. This way PIC sends characters continuously. I wanna send 64 bits together. Is that possible?

I'm using matrix method for button interactions, got no problem there.
I added code. tx_msg array size is 7. I want to increase this to 64.
Code: Select all
void usb_keyboard_task(void)
   static int8 tx_msg[7]={0,0,0,0,0,0,0};
   static int8 leds;



   //receive NUM LOCK, CAPS LOCK, etc LED status from PC.
   //we won't do anything with it.
   if (usb_kbhit(2))
      usb_get_packet(2, &leds, 1);

void main(void)


   while (TRUE)
Posts: 3
Joined: 15 Nov 2016, 11:31
Country: Australia
Has thanked: 0 time
Been thanked: 0 time

USB Keyboard with 18F2550


Re: USB Keyboard with 18F2550

Postby maxpiano » 16 Nov 2016, 11:57

If I were you I'rather use an Arduino, there is a freely available MIDI library too that makes creating MIDI tools with Arduino a breeze. i have MIDIfied an old organ pedalboard using an Arduino (developed on a Lenorado board then scaled down to use a AT-Tiny) and works like a charm.
Last edited by maxpiano on 16 Nov 2016, 11:58, edited 2 times in total.

The author maxpiano was thanked by:
User avatar
Patch Creator
Posts: 2954
Joined: 27 Jun 2011, 13:29
Location: Italy
Country: Italy
Has thanked: 214 times
Been thanked: 953 times
Your Nord Gear #1: Nord Stage 2

Return to Off Topic / About this Forum

Who is online

Users browsing this forum: No registered users and 0 guests