2 beginner's question

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
hker
Posts: 1
Joined: Sun Apr 17, 2011 2:44 pm

2 beginner's question

Post by hker » Sun Apr 17, 2011 3:19 pm

I started to read source code of V-USB since yesterday so I don't know much
I'm familiar with 8051(AT89S52) but I'm new to attinny/mega
I've no idea reading the wiki so I just try to study the source code.

I'm going to make a IR emitter project, I use the chip for the signal, not carrier(done by other chips)

In the power switch project,
I'm trying to give a specific pulse when a turning LED on signal is recieved
I traced the function in main.c(not changed)
static void outputByte(uchar b)
{
PORTB = (PORTB & ~0xfc) | (b & 0xfc);
PORTD = (PORTD & ~0x30) | ((b << 4) & 0x30);
}
Can I add lines of pulse in this section?
I am trying to use _delayms() function with a for loop to give out the pulse and return to the main program.
If I increase the time of this function, will there be problem on USB communication?
If I can't, how can I estimate the time per cycle?
I just know that #define USB_CFG_INTR_POLL_INTERVAL 10mill
but the pulse must be in microsecond

I'm going to migrate this project into attiny45 because number of ports is enough and i need many of it for saving cost
These are the parts that I found should be changed(not changed):
usbconfig.h:
#define USB_CFG_IOPORTNAME B
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DPLUS_BIT 1
main.c:
"all port and DDR"

For makefile
I'll use mfile of WinAVR
The options are as follows :
Image

Is it correct to only set the code generation part appropriately and save it? Any extra settings?
Is the above settings enough?

size optimation maybe needed for the added pulse
who of the following measures can i take?
viewtopic.php?f=8&t=5587

*I'm going to try the above things using pronyprog tomorrow

Post Reply