Search found 737 matches

by spamiam
26 September 2017, 2:44 AM
Forum: ZBasic IDE
Topic: Compiling for Arduino 328 target
Replies: 9
Views: 4657

I do not know for a fact that the ZA-328 is assuming the 28 or 32 pin package. As I recall the 32 pin has 2 extra analog-only pins and I am not using those in the project in question. For my needs it is not critical to have the ZA-328 target function properly because I have a generic license. And ma...
by spamiam
25 September 2017, 19:12 PM
Forum: ZBasic IDE
Topic: Compiling for Arduino 328 target
Replies: 9
Views: 4657

Ah, a stillborn third party device. That explains the undocumented target! So, it assumes 16Mhz on the CPU. What are the RTC settings and other parameters it will use? Would it be what I would generate in the "Target options" window? E.G. ZBasic bootloader, MLF-32, 16MHZ, RTC enabled, 500 ...
by spamiam
25 September 2017, 18:46 PM
Forum: ZBasic IDE
Topic: Compiling for Arduino 328 target
Replies: 9
Views: 4657

Don, By the way, I see the ZA-328 as a listed target. i was assuming that the "A" in the name means Arduino. But I do not see any info on the "ZA" devices in the reference manuals. Did I miss it? Is it choosing the ZA-328 as the target that will create "generic" type co...
by spamiam
25 September 2017, 9:19 AM
Forum: ZBasic IDE
Topic: Compiling for Arduino 328 target
Replies: 9
Views: 4657

Hmmmm... Good Question! I thought it was in one of the manuals for ZBasic. But I don't see it now. As I recall, it was a chart showing a few ATMega processors in one column and then another column listing Optiboot, and maybe another bootloader as some sort of option for that CPU. But the chart did n...
by spamiam
25 September 2017, 7:57 AM
Forum: ZBasic IDE
Topic: Compiling for Arduino 328 target
Replies: 9
Views: 4657

Thanks Don, I will send you the source code for you to try. My ZBasic installation is a fresh brand new installation on a Win10 laptop. I originally developed the program on my Win7 desktop running an OLD version of the compiler and IDE. I have been compiling there using the generic 328P as the targ...
by spamiam
25 September 2017, 4:29 AM
Forum: ZBasic IDE
Topic: Compiling for Arduino 328 target
Replies: 9
Views: 4657

Compiling for Arduino 328 target

I see that the newest IDE/Compiler seems to have the ability to compile for an arduino target. I have some Nano clones that I might be able to use. I selected the ZA-328 as the target for the compiler. When I compiled my pre-existing code (used for a generic ATMeg-328P, 16 MHz), I received the follo...
by spamiam
24 September 2017, 12:20 PM
Forum: ZBasic Language
Topic: ReadPin() return value
Replies: 2
Views: 3038

Thanks, Don. It is not a problem. It is easy to use "<> 0" instead of "= 1". I do not know the assembly language options, but it may be faster to compare to zero than to a non-zero number where the non-zero argument number may need to be loaded into a register for comparison. I w...
by spamiam
24 September 2017, 4:52 AM
Forum: ZBasic Language
Topic: ReadPin() return value
Replies: 2
Views: 3038

ReadPin() return value

I am FINALLY, after a LONG hiatus getting back to a project. It is some software to interface to an IEEE-488 (GPIB) bus. As usual, It is MUCH MUCH easier to do development in ZBasic rather than C/Arduino. In the documentation of PinRead() it says a non-zero return value indicates a logic high Is thi...
by spamiam
26 March 2016, 15:03 PM
Forum: ZBasic Language
Topic: PWM'ing a hardware LED
Replies: 10
Views: 2952

Re: Looping a WaitForInterrupt() independently of the main c

FWIW, I suggest that you use Halls; IMO dealing with contact bounce is wasted time, and I've had reed switches stick closed. Wow, you made those units really well! I agree, a hall sensor will work well in this application. In general I like the simplicity of reed switches, but it would be no proble...
by spamiam
26 March 2016, 8:55 AM
Forum: ZBasic Language
Topic: PWM'ing a hardware LED
Replies: 10
Views: 2952

Short pulses could be a problem in the general case. I am not sure how short the pulses will actually be. I have what is in effect a rotating bar magnet. And I will either use a reed switch or a hall sensor. The reed switch is susceptible to bounce and this could require extra hardware/effort to de...
by spamiam
26 March 2016, 6:36 AM
Forum: ZBasic Language
Topic: PWM'ing a hardware LED
Replies: 10
Views: 2952

Don, I actually got the WaitForInterrupt() working without having to ask a question. Actually, as I wrote the forum post, it made me think about it clearly. My main problem was my thinking in terms of a C ISR that will get executed automatically for every interrupt whereas in ZBasic I need to create...
by spamiam
26 March 2016, 6:21 AM
Forum: ZBasic Language
Topic: Looping a WaitForInterrupt() independently of the main code
Replies: 1
Views: 1165

Looping a WaitForInterrupt() independently of the main code

I am trying to detect a Hall sensor and count the number of switching events. I can use a pin change interrupt, and once the interrupt is serviced, I want it to be ready to run again. As I wrote this message, it made my sit down and explain what I was doing, and I realized that 1) The WaitForInterru...
by spamiam
26 March 2016, 6:08 AM
Forum: ZBasic Language
Topic: PWM'ing a hardware LED
Replies: 10
Views: 2952

Re: PWM'ing a hardware LED

If you look at the diagram in the datasheet showing the structure of an I/O pin it looks like the pin change won't be seen unless the pin is in an input mode. To test this hypothesis, modify your code to sense a pin change on a different pin and hard wire B.3 to that pin. Now that you mention it, I...
by spamiam
25 March 2016, 14:27 PM
Forum: ZBasic Language
Topic: PWM'ing a hardware LED
Replies: 10
Views: 2952

Re: PWM'ing a hardware LED

There are two issues in the code you've used...... Ah, that solved it. I set it to phase correct and got the frequency down to 28.2Hz. I can just barely see a flicker in the LED at 50% duty. Now the next problem. I have never used WaitForInterrupt() before. I want to use B.3 (being toggled by the t...
by spamiam
25 March 2016, 9:27 AM
Forum: ZBasic Language
Topic: PWM'ing a hardware LED
Replies: 10
Views: 2952

PWM'ing a hardware LED

I have a ZX-328nu device. It has an active low Red LED on pin 14 (B.3) which is the PWM A output for Timer/Counter2. I have a stupid question. I know I have successfully done this before, but it has been a while. I want to PWM this LED, and do it slow enough to see it by eye. So, 1-4Hz and 50% duty ...